Re: Clues on modeling a really simple concept

From: jefftyzzer <jefftyzzer_at_sbcglobal.net>
Date: Mon, 6 Apr 2009 16:38:54 -0700 (PDT)
Message-ID: <13ae5b62-0a6f-475b-9693-24d196225fb7_at_s22g2000prg.googlegroups.com>


On Apr 6, 3:40 pm, Spike <fau..._at_gmail.com> wrote:
> On 6 abr, 23:11, Bernard Peek <b..._at_shrdlu.com> wrote:
>
>
>
> > In message
> > <16d72645-6a6b-4fd4-bccf-d5002970f..._at_q2g2000vbr.googlegroups.com>,
> > Spike <fau..._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
>
> Hi!
>
> I was thinking about system performance vs. normalization. By adding
> that extra relationship, three-level joins can be avoided, and so
> stressing the dbms too much.
>
> Do you think is a good idea in general to denormalize the data model
> by means of performance?
>
> Thanks!

Spike,

I'm not sure if you're deliberately trying to be provocative, but I'd say it's fair to characterize this newsgroup as denormalizationhostile  ;-).

What's more important, I think, is to put first things first, and as I hinted at--and others made explicit--what's paramount is getting the requirements right and accurately modeling the problem domain. If users create galleries, and/or galleries can exist independently of any pictures being assigned to them, then model accordingly. Period.

Bottom-line, IMHO: 1) model the domain accurately, and 2) deviate from the model only when *truly* warranted (NB that often denormalization is zero-sum--who cares when the data comes back faster when it's wrong or contradictory?). You might want to see if you can find a copy of "The Normal Is So... Interesting" by Chris Date (DBP&D 11/97) for more on the topic of denormalization. Many other sources abound.

Regards,

--Jeff Received on Tue Apr 07 2009 - 01:38:54 CEST

Original text of this message