Re: OIDs - can they be used for accessing records ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: OIDs - can they be used for accessing records ?
Дата
Msg-id 26487.1043854441@sss.pgh.pa.us
обсуждение исходный текст
Ответ на OIDs - can they be used for accessing records ?  (Derek Clarkson <dhc@bigpond.net.au>)
Список pgsql-novice
Derek Clarkson <dhc@bigpond.net.au> writes:
>     I am currently designing a DB and was wondering whether the OIDs assigned to
> each record could also be used as foreign keys links ? is this a good idea
> instead of using sequences ? Pros ? Cons ?

It's usually considered a bad idea, mainly because there's no good way
to dump and reload the data (well, you can use pg_dump's -o switch,
but that's a kluge).  Also you have little or no control over the
possibility of OID wraparound leading to key conflicts.  Sequences are
a much cleaner solution.

Be careful to keep track of whether you're using int4 or int8 sequence
values, and declare the foreign key referencing columns to match.  You
will take a nasty performance hit if they don't match.

            regards, tom lane

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

Предыдущее
От: Steve_Miller@sil.org
Дата:
Сообщение: Good books?
Следующее
От: "Steinn E. Sigurdarson"
Дата:
Сообщение: Re: Good books?