Re: IS it a good practice to use SERIAL as Primary Key? - Mailing list pgsql-general

From Jim Nasby
Subject Re: IS it a good practice to use SERIAL as Primary Key?
Date
Msg-id E90A59E4-8BD2-4E1A-A4BD-29ADA695A344@decibel.org
Whole thread Raw
In response to Re: IS it a good practice to use SERIAL as Primary Key?  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
On Nov 23, 2006, at 10:23 AM, Ron Johnson wrote:
> I'm one of those who thinks that a (possibly multisegment) natural
> key *does* exist, and that if you think it doesn't, your design is
> wrong.

I agree, but that doesn't mean you want to be spreading that multi-
field key throughout your database. For example, origination,
destination, flight_number, and date together make a unique key for a
segment of a flight. But that doesn't mean you want to be storing all
that info in every other table in the database that references a
segment. Not only does moving all that data around become non-
trivial, writing all that stuff into all the joins is error-prone
(not to mention a PITA).
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)



pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: NULLs ;-)
Next
From: "Harald Armin Massa"
Date:
Subject: Re: PostgreSQL doesn't accept connections when Windows