| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера