Re: Primary Key - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Primary Key
Date
Msg-id b42b73150711161341s6b4536c7re9ac7e26c65bf00c@mail.gmail.com
Whole thread Raw
In response to Re: Primary Key  (Sam Mason <sam@samason.me.uk>)
Responses Re: Primary Key  (Sam Mason <sam@samason.me.uk>)
Re: Primary Key  (Greg Smith <gsmith@gregsmith.com>)
List pgsql-general
On Nov 16, 2007 3:21 PM, Sam Mason <sam@samason.me.uk> wrote:
> On Fri, Nov 16, 2007 at 12:06:46PM -0800, Joshua D. Drake wrote:
> > When that is needed I do this:
> >
> > create table foo(id serial unique, a text, b text, primary (a,b));
>
> Humm, so the other way around from what I've ended up doing.  I'll need
> to think about the implications of changing things around like this.
> There are lots of things that seems as though they'll be pretty awkard
> to do, I'm sure it's just because I haven't thought about it enough.

there is a lot of nuance to this debate and tons of hyperbole on both
sides.  There are many side effects, pro and con, about choosing
'natural' keys vs. surrogates.  josh's suggestion is the most
reasonable compromise, because it allows you to get the performance
benefits (which are sometimes overrated) when you need it, but still
forces you to think about how your data is _truly_ organized and what
makes each record unique.  the sad fact is that sequences have made
developers lazy, not giving much thought to proper normalization
strategies which in turn often produces lousy databases.  if you know
how to do things properly, you will know what we mean.

merlin

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: convert access sql to postgresql
Next
From: "Ed L."
Date:
Subject: Re: view management