are sql shortcuts a good practice ?

From: gabriel <spam_at_yahoo.fr>
Date: Thu, 07 Jul 2005 12:26:15 +0200
Message-ID: <42cd0344$0$17426$636a15ce_at_news.free.fr>



greetings,

I'm taking over an old DB and cannot decide if something which was done in it is good or bad :

A,B,C,D are tables linked together with foreign keys : A->B->C->D

What the former team has done is to store the value of the foreign key A in D. This is what I call a shortcut : instead of having to jump through the diffents links, you just retrieve the last value (D).

Of course, this means that you have to make sure that when changing values, you change it at both places which can be risky.

As a developper, I find it rather convenient, of course, but the question that keeps gnawing at me is this : is it good or bad ?
What if I had 10 jumps instead of 4, would it be still bad ?

Come to think of it, I guess views should have been used instead.

This is not a troll, I'm no DB designer, I'm just a java developper trying to figure out the way the db works :)

thank you for your opinions... Received on Thu Jul 07 2005 - 12:26:15 CEST

Original text of this message