Forum: Ruby on Rails has_one performance

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Federico F. (Guest)
on 2007-04-13 03:15
Hi!

I'm designing the data model of an application.

I have a table "people" who have a lot of attributes. Some of them are:
"phone number", "AOL Nickname", "Yahoo Nickname", "MSN Nickname",
"e-mail 1" and "e-mail 2"

I have to options to model this:

1) Creating a table:
contact_informations(aol, yahoo, msn, email2, email2)
and then doing:
Person has_one :contact_information

Or...

2) Just putting those attributes in the table "people"?

I will probably want to query the people table to get a list of e-mails
of a given set of people. Will I have a significant loss of performance
if I use the first option?

In other words: anyone knows what's the compromise in performance when
using has_one instead of just storing the value as an attribute?

Cheers,
Federico F.
unknown (Guest)
on 2007-04-13 03:39
(Received via mailing list)
What do you perceive as advantages to the first option? I don't really
see
any reason for it. Performance isn't an issue here, but surely the
second
option is just simpler, and that's a pretty good reason to go with it.
-Nathan
Federico F. (Guest)
on 2007-04-13 04:30
unknown wrote:
> What do you perceive as advantages to the first option? I don't really
> see
> any reason for it. Performance isn't an issue here, but surely the
> second
> option is just simpler, and that's a pretty good reason to go with it.
> -Nathan

I just feel that it's prettier.. but you are right, the other way is
simpler, and prettier :d
This topic is locked and can not be replied to.