Re: OIDs - can they be used for accessing records ? - Mailing list pgsql-novice

From Tom Lane
Subject Re: OIDs - can they be used for accessing records ?
Date
Msg-id 26487.1043854441@sss.pgh.pa.us
Whole thread Raw
In response to OIDs - can they be used for accessing records ?  (Derek Clarkson <dhc@bigpond.net.au>)
List 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 by date:

Previous
From: Steve_Miller@sil.org
Date:
Subject: Good books?
Next
From: "Steinn E. Sigurdarson"
Date:
Subject: Re: Good books?