Re: Use of OIDS as primary keys

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Use of OIDS as primary keys
Дата
Msg-id 20020514153639.A9380@svana.org
обсуждение исходный текст
Ответ на Re: Use of OIDS as primary keys  (Bill Moran <wmoran@potentialtech.com>)
Ответы Re: Use of OIDS as primary keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Mon, May 13, 2002 at 09:26:20PM -0400, Bill Moran wrote:
> I'm also curious about the use of WITHOUT OIDS in the creation of
> tables.
> Somewhere I gleaned from the docs that OIDS aren't necessary, but they are
> a good idea when there is no primary key.  Thus, I've been adding "WITHOUT
> OIDS" on any table that has a primary key.
> Is there any drawback to this?  I figure it's saving 4 bytes per record,
> right? (it adds up when you have 100,000 records)
> But I don't understand why OIDs are ever necessary.  It seems like they
> could be useful at times, but if I need something that works like a
> primary key, I'll create a primary key.
>
> I guess the ultimate question in all this is "Is there any ill effect from
> using WITHOUT OIDS on a table that doesn't have a primary key?"

OIDs are used extensivly in the system tables to reference functions,
tables, attributes etcetera. I don't beleive they were ever particularly
useful for non-system tables (hence the option to remove them).

Do they actually save spaces (consider alignment issues and such)?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Canada, Mexico, and Australia form the Axis of Nations That
> Are Actually Quite Nice But Secretly Have Nasty Thoughts About America

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

Предыдущее
От: "Robert Abbate"
Дата:
Сообщение: transitioning postgres oid
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Use of OIDS as primary keys