Re: Understanding oid for a record

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Understanding oid for a record
Дата
Msg-id 20841.1166465080@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Understanding oid for a record  ("Brusser, Michael" <Michael.Brusser@matrixone.com>)
Список pgsql-hackers
"Brusser, Michael" <Michael.Brusser@matrixone.com> writes:
> Can I assume that oid for any new record will be larger than oid on any
> other existing rows?

No; that will fail once the installation has consumed 4G OIDs.  The
counter just wraps around.

However, if you pay attention to the OID value returned in the INSERT
command result, you could fetch that and not have to assume anything
about max().

You will want to create a unique index on OID if you are using it this
way, first for efficiency of the fetch and second to prevent the
creation of duplicate entries after wraparound.

If you expect more than perhaps 100M rows in the table, you probably
need to think of another way, because of the likelihood of OID collisions.
        regards, tom lane


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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Understanding oid for a record
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_restore fails with a custom backup file