Re: PostgreSQL Developer Best Practices

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: PostgreSQL Developer Best Practices
Дата
Msg-id A76B25F2823E954C9E45E32FA49D70ECCD5127D0@mail.corp.perceptron.com
обсуждение исходный текст
Ответ на Re: PostgreSQL Developer Best Practices  (Melvin Davidson <melvin6925@gmail.com>)
Ответы Re: PostgreSQL Developer Best Practices  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Melvin Davidson
Sent: Tuesday, August 25, 2015 8:18 PM
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Jerry Sievers <gsievers19@comcast.net>; John R Pierce <pierce@hogranch.com>; pgsql-general@postgresql.org
Subject: Re: [GENERAL] PostgreSQL Developer Best Practices

 

….

Before ANYONE continues to insist that a serial id column is good, consider the case where the number of tuples will exceed a bigint.

Don't say it cannot happen, because it can.

……………………

Melvin Davidson

 

Now, it’s easy to overcome this limitation.

You just make concatenated PK (id1, id2) with both columns of BIGINT type.

 

In general, I see the main advantage of artificial PK in NO NEED to change multiple child tables, when NATURAL key changes in the parent table.  And I never saw a system where NATURAL key wouldn’t need to be changed eventually.

So, my conclusion: use artificial PK (for db convenience)  and unique NATURAL key (for GUI representation).

 

Regards,

Igor Neyman

 

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

Предыдущее
От: Kaushal Shriyan
Дата:
Сообщение: Point in time recovery
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: PostgreSQL Developer Best Practices