Re: Use of OIDS as primary keys

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Use of OIDS as primary keys
Date: 2002-05-14 05:36:39
Message-ID: 20020514153639.A9380@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-05-14 06:02:52 Re: Use of OIDS as primary keys
Previous Message Jeff Davis 2002-05-14 04:17:09 Re: Quotes in SQL