# Has\_one performance

**URL:** <https://www.ruby-forum.com/t/has-one-performance/91878>\
**Category:** Rails\
**Created:** [April 13, 2007, 1:15am UTC](https://www.ruby-forum.com/t/has-one-performance/91878 "2007-04-13T01:15:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/df788c/32.png) [@pix](https://www.ruby-forum.com/u/pix)\
**Post date:** [April 13, 2007, 1:15am UTC](https://www.ruby-forum.com/t/has-one-performance/91878/1 "2007-04-13T01:15:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/df788c/32.png) [@pix](https://www.ruby-forum.com/u/pix)\
**Post date:** [April 13, 2007, 1:39am UTC](https://www.ruby-forum.com/t/has-one-performance/91878/2 "2007-04-13T01:39:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/df788c/32.png) [@pix](https://www.ruby-forum.com/u/pix)\
**Post date:** [April 13, 2007, 2:30am UTC](https://www.ruby-forum.com/t/has-one-performance/91878/3 "2007-04-13T02:30:56Z")

</div>

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
