Re: Thought on OIDs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Thought on OIDs
Дата
Msg-id 21287.983462383@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Thought on OIDs  (Patrik Kudo <kudo@partitur.se>)
Список pgsql-general
Patrik Kudo <kudo@partitur.se> writes:
> A thought just hit me and I got a bit worried... If OIDs are "globaly"
> unique and I have a very high data-throughput on my database, i.e. I do a
> lot of inserts and deletes, is it then possible to "run out" of OIDs? If
> this can occur, will it cause any problems?

The OID counter will eventually wrap around, which means that OIDs are
not necessarily as unique as all that.  This need not bother you unless
your application logic assumes that it can use OID as a unique key for a
table.  If so, I recommend making sure that the OIDs in a particular
table are indeed unique, by creating a unique index on oid.  (This might
lead to occasional insertion failures, which can simply be retried until
they succeed.)  Avoid assuming that OIDs are unique across tables,
because there is no way to enforce that.

There is some talk of eventually offering an 8-byte-OID compile-time
option, which would avoid this can of worms.  However the pain level
would be high --- for example, did you know that there are OIDs in the
wire protocol?  An 8-byte-OID server would not be able to talk to
4-byte-OID client libraries.

            regards, tom lane

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

Предыдущее
От: Denis Perchine
Дата:
Сообщение: Re: Postgres eats up memory when using cursors
Следующее
От: "Paolo Sinigaglia"
Дата:
Сообщение: R: Date types in where clause of PreparedStatement