Re: Any *real* reason to choose a natural, composite PK

Поиск
Список
Период
Сортировка
От Brent Wood
Тема Re: Any *real* reason to choose a natural, composite PK
Дата
Msg-id 20060609121307.L7739@storm-user.niwa.co.nz
обсуждение исходный текст
Ответ на Re: Any *real* reason to choose a natural, composite PK over a surrogate, simple PK?  (dananrg@yahoo.com)
Список pgsql-general

A bit simplistic, but in a nutshelll....


They are used for different things. A natural PK is used for data
integrity purposes, and if it is a single attr, it can also be a
performance enhancing index.

An artificial key is used to speed up queries, by allowing joins on a
single indexed attribute.

So use your composite, data driven, unique index as an integrity rule to
prevent duplicates, and use an artificial PK to enhance performance on
queries & joins. When you need to enhance performance is largely up to
you, unless you require your design to always maximise efficiency.


HTH,

 Brent Wood

В списке pgsql-general по дате отправления:

Предыдущее
От: "pobox@verysmall.org"
Дата:
Сообщение: Re: 010.pgsql.sh does not react
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: 010.pgsql.sh does not react