Re: Numbering Rows (SEQUENCE, OID) questions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Terrence Brannon <metaperl(at)mac(dot)com>
Cc: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Numbering Rows (SEQUENCE, OID) questions
Date: 2001-12-17 17:04:07
Message-ID: 200112171704.fBHH47405974@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

>
> On Sunday, December 16, 2001, at 11:42 AM, Stephan Szabo wrote:
>
> > On Sun, 16 Dec 2001, Terrence Brannon wrote:
> >
> >> The Momjian book is excellent (in spite of some of the bonehead
> >> reviews on amazon.com). I just finished the "Numbering Rows"
> >> section and have a few questions. None of these were in the FAQ,
> >> BTW.
> >>
> >> 1 - are OIDs ever re-used if rows are deleted?
> >
> > OIDs wraparound, but they don't just fill holes, so uniqueness
> > isn't guaranteed unless you have something like a unique index
> > on oid.
>
> Where do you get this information? If I am reading the Momjian
> book correctly, it disagrees with you:
>
> Every row in POSTGRESQL is assigned a unique, normally invisible
> number called an object identification number (OID). When the
> software is initialized with initdb?, 12.1 a counter is created
> and set to approximately seventeen-thousand. 12.2 The counter is
> used to uniquely number every row. Although databases may be
> created and destroyed, the counter continues to increase. It is
> used by all databases, so identification numbers are always
> unique. No two rows in any table or in any database will ever
> have the same object ID.

The book asssume you are not going to roll over the counter. Very large
installations have been concerned about such rollover after inserting >4
billion rows. We have not gotten any actual report of it happening, but
it could theoretically happen.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2001-12-17 19:50:02 Re: Storing number '001' ?
Previous Message Terrence Brannon 2001-12-17 10:41:09 Re: Numbering Rows (SEQUENCE, OID) questions

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2001-12-17 17:06:10 Re: how could a foreign key ever be NULL?
Previous Message Henshall, Stuart - WCP 2001-12-17 15:20:52 Re: weird duplicate data problem