Has_one performance


#1

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…

  1. 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.


#2

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


#3

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