Re: Advice on key design

Поиск
Список
Период
Сортировка
Искать
От
Luca Ferrari
Тема
Re: Advice on key design
Дата
Msg-id
CAKoxK+57gzt1zQsVXRPmswqV=r5UQPxCBoHbnEh2zzJKe=r9vQ@mail.gmail.com
Ответ на
Re: Advice on key design (Bèrto ëd Sèra)
Список
Дерево обсуждения
Advice on key design JORGE MALDONADO <jorgemal1960@gmail.com>
Re: Advice on key design Anton Gavazuk <antongavazuk@gmail.com>
Re: Advice on key design Anton Gavazuk <antongavazuk@gmail.com>
Re: Advice on key design JORGE MALDONADO <jorgemal1960@gmail.com>
Re: Advice on key design Anton Gavazuk <antongavazuk@gmail.com>
Re: Advice on key design Anton Gavazuk <antongavazuk@gmail.com>
Re: Advice on key design Stanley Hui <ufrufr@gmail.com>
Re: Advice on key design Bèrto ëd Sèra <berto.d.sera@gmail.com>
Re: Advice on key design Luca Ferrari <fluca1978@infinito.it>
Re: Advice on key design Bèrto ëd Sèra <berto.d.sera@gmail.com>
Re: Advice on key design Luca Ferrari <fluca1978@infinito.it>
Re: Advice on key design Bèrto ëd Sèra <berto.d.sera@gmail.com>
On Wed, Jul 24, 2013 at 10:38 AM, Bèrto ëd Sèra  wrote:

> What would be the rationale behind the serial number?
>

The serial key, also named "surrogate key" is there for management
purposes. Imagine one day you find out your database design is wrong
and what was unique the day before is no more so, how can you find
your records?
The idea is to have a surrogate key to save you from real world
troubles, and then constraints to implement the database design.

I usually use this convention:
- primary surrogate keys named pk and defined as primary keys
- database design keys named _key and defined with a unique constraint.

Luca


В списке pgsql-sql по дате отправления
От: Bèrto ëd Sèra
Дата:
Сообщение: Re: Advice on key design
От: Bèrto ëd Sèra
Дата:
Сообщение: Re: Advice on key design
FAQ