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. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-12 23:37 UTC
Re: has_one performance
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 On 13/04/07, Federico Fernandez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > 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. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. > -NathanI just feel that it''s prettier.. but you are right, the other way is simpler, and prettier :d -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---