Re: Clues on modeling a really simple concept

From: Bernard Peek <bap_at_shrdlu.com>
Date: Mon, 6 Apr 2009 22:11:42 +0100
Message-ID: <ppaRYFaOAn2JFwZx_at_shrdlu.com>


In message
<16d72645-6a6b-4fd4-bccf-d5002970f9ff_at_q2g2000vbr.googlegroups.com>, Spike <fauria_at_gmail.com> writes
>
>My question is: Should i add a relationship between galleries and
>users?
>
>I would like to query which galleries a user has, and i don't really
>know if it is worth adding a foreign key rather than doing a three-
>level join query each time i want to obtain this data.

Less is more. The database is fully normalised without adding an extra relationship. You shouldn't denormalise without a good reason. Denormalised systems are usually more fragile and will cost you more time in programming and maintenance.

Of course if there is some other real-world relationship between galleries and users you may need to change the model. Do galleries have Owners, for instance and would those be Users?

-- 
Bernard Peek
Received on Mon Apr 06 2009 - 23:11:42 CEST

Original text of this message