Re: OID as Primary Key

From: Karl DeBisschop <kdebisschop(at)alert(dot)infoplease(dot)com>
To: Jonas Bengtsson <jonas(dot)b(at)home(dot)se>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OID as Primary Key
Date: 2001-03-22 15:49:00
Message-ID: 3ABA1EEC.42C74619@alert.infoplease.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jonas Bengtsson wrote:
>
> Can't you do a dump with the oid's?
>
> But when I want to know the primary key of the inserted row
> I have to do an extra select query. If I use oid I just use
> pg_getlastoid() in php.
> And it is redundant data to store another integer.
>
> Comments?

I have often used OID as primary key, usually for the reason's you cite.
IMHO, in the long run, the two major extra worries are often not worth
it:

1) You must explicitly dump and restore OIDs all the time
2) You loose generic SQL compatibility

On the other hand, we've never had a failure from theses causes. In
short, using OIDs seems to work well enough for us, but the downsides in
practice have been larger than we expected, and the upsides smaller. In
our case, the extra serial would be a small part of the overall data, so
I kind of wish I had not used OIDs.

Just my $0.02 worth.

--
Karl

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-22 15:52:10 Re: Re: Call for platforms
Previous Message The Hermit Hacker 2001-03-22 15:31:07 Re: Re: Call for platforms