| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Derek Clarkson <dhc(at)bigpond(dot)net(dot)au> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: OIDs - can they be used for accessing records ? |
| Date: | 2003-01-29 15:34:01 |
| Message-ID: | 26487.1043854441@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
Derek Clarkson <dhc(at)bigpond(dot)net(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2003-01-29 15:37:25 | Re: Silly Question about varchar(n) |
| Previous Message | Steinn E. Sigurdarson | 2003-01-29 15:31:01 | Re: Good books? |