Re: OID as Primary Key

Поиск
Список
Период
Сортировка
От Karl DeBisschop
Тема Re: OID as Primary Key
Дата
Msg-id 3ABA1EEC.42C74619@alert.infoplease.com
обсуждение исходный текст
Ответ на Re: Re: OID as Primary Key  (Jonas Bengtsson <jonas.b@home.se>)
Список pgsql-general
Jonas Bengtsson wrote:
>
> Can't you do a dump with the oid's?
>
> But when I want to know the primary key of the inserted row
> I have to do an extra select query. If I use oid I just use
> pg_getlastoid() in php.
> And it is redundant data to store another integer.
>
> Comments?

I have often used OID as primary key, usually for the reason's you cite.
IMHO, in the long run, the two major extra worries are often not worth
it:

1) You must explicitly dump and restore OIDs all the time
2) You loose generic SQL compatibility

On the other hand, we've never had a failure from theses causes. In
short, using OIDs seems to work well enough for us, but the downsides in
practice have been larger than we expected, and the upsides smaller. In
our case, the extra serial would be a small part of the overall data, so
I kind of wish I had not used OIDs.

Just my $0.02 worth.

--
Karl

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

Предыдущее
От: Björn Lundin
Дата:
Сообщение: Re: Database shutdown
Следующее
От: Loïc Courtois
Дата:
Сообщение: