Re: Primary Key

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Primary Key
Дата
Msg-id b42b73150711161341s6b4536c7re9ac7e26c65bf00c@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Primary Key  (Sam Mason <sam@samason.me.uk>)
Ответы Re: Primary Key
Re: Primary Key
Список 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 по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: convert access sql to postgresql
Следующее
От: "Ed L."
Дата:
Сообщение: Re: view management