Re: Table design question - Mailing list pgsql-sql

From postgres@jal.org
Subject Re: Table design question
Date
Msg-id 20060601164450.GA24982@clueinc.net
Whole thread Raw
In response to Table design question  ("David Clarke" <pigwin32@gmail.com>)
List pgsql-sql
On Thu, 01 Jun 2006, David Clarke wrote:

> So I'm designing a table and I'm looking for an appropriate key. The
> natural key is a string from a few characters up to a maximum of
> perhaps 100. Joe gets quite fierce about avoiding the use of a serial
> id column as a key. The string is unique in the table and fits the

The use of surrogate keys is a mostly religious issue. Celko is an
Orthodox, many others are Reform. Where you want to align yourself
is a personal choice. 

In defense of the Reform movement, I'd note that modern DBs are more
performant with ints than varchars. More importantly, I've found it
much easier to modify DBs designed with surrogate keys than natural
keys, especially when natural keys span columns. It allows a rather
simple convention for coders to write against, and avoids some messy
modification issues when the spec changes.

It is not my intention to bash the purists, and there are good arguments
on the Ortho side, too. I'm merely giving a bit of advice from the
point of view of someone who lives in the constant evolution side
of DB usage.

-j

-- 
Jamie Lawrence                                        jal@jal.org
When I was a boy I was told that anybody could become President. 
Now I'm beginning to believe it.  - Clarence Darrow




pgsql-sql by date:

Previous
From: Miroslav Šulc
Date:
Subject: Re: SELECT DISTINCT too slow
Next
From: "Collin Peters"
Date:
Subject: Am I crazy or is this SQL not possible