Search Postgresql Archives

Re: Primary Key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 16, 2007 3:21 PM, Sam Mason <sam@xxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux