Ruby on Rails Sunday, January 2, 2011

David Zhu wrote in post #971909:
> Hello,
>
> I have a user table that stores their username, email address, and
> password. (along with salt, etc)
>
> However, now I want to have more complex information associated with
> each user (address, etc). I'm no DBA expert, so in terms of
> performance, which is better:
>
> - A user table that has all the fields in it (Username, Email,
> password, country, state, zipcode, etc)
> - A user table that only has username/password/email, that is
> connected via a foreign key to another table that stores all the other
> fields.
>
> Which is better? And why?

The first will be slightly better in terms of performance, because
you're not joining tables. But if your tables are properly indexed, the
join should have a negligible effect on performance.

However, I don't see why you'd use the second approach. It's more
complex for no particular gain.

>
> Thank you
>
> -David Zhu

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

Sent from my iPhone

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment