Re: IS it a good practice to use SERIAL as Primary Key?

From: Jim Nasby <decibel(at)decibel(dot)org>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: IS it a good practice to use SERIAL as Primary Key?
Date: 2006-11-27 22:53:04
Message-ID: E90A59E4-8BD2-4E1A-A4BD-29ADA695A344@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-11-27 22:53:36 Re: IS it a good practice to use SERIAL as Primary Key?
Previous Message Scott Ribe 2006-11-27 22:47:28 Re: IS it a good practice to use SERIAL as Primary Key?