Why schemas and not code?

Andy Armstrong andy at hexten.net
Fri Jun 30 11:19:52 BST 2006

On 30 Jun 2006, at 10:52, ti at lemonia.org wrote:
> This was the case I referred to in passing as "refer to abstract  
> numeric
> keys instead". That may not be the correct term. In fact, although I'm
> convinced of the value of using numeric/serial primary keys for almost
> every table, I'm unclear what, if any, level of normalisation that
> corresponds to.

 From a programmer's perspective normalisation is pretty much the  
process of squeezing out any redundancy. Each datum should appear  
just once in the database - so 'Alanis Morissette' should appear only  
once in the database (and ideally shouldn't be audible at all...)

Wherever you refer to Alanis you should instead refer to her primary  
key. So using keys is central to normalisation but doesn't  
automatically imply or ensure normalisation.

Bear in mind though that it's about eliminating semantic redundancy  
rather than textual redundancy. So let's say that in addition to your  
lists of artists you run a forum from the same database and one of  
your forum users chooses the alias 'Alanis Morissette'. That's  
semantically different from the artist known as 'Alanis Morissette'  
and there should be no connection between the two.

Good practice is generally to develop a completely normalised schema  
and then, if necessary, de-normalise to improve performance or  
satisfy some other operation requirement.

Andy Armstrong, hexten.net

More information about the london.pm mailing list