pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Terrence Brannon <metaperl@mac.com>
Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Numbering Rows (SEQUENCE, OID) questions
Date: Mon, 17 Dec 2001 12:04:07 -0500 (EST)
Message-ID: <200112171704.fBHH47405974@candle.pha.pa.us> (raw)
In-Reply-To: <94F668C2-F2DA-11D5-92F7-003065C2A10C@mac.com>

> 
> 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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (4+ messages)

Message-ID: <200112171704.fBHH47405974@candle.pha.pa.us>
Permalink:  ../200112171704.fBHH47405974@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200112171704.fBHH47405974@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, metaperl@mac.com, sszabo@megazone23.bigpanda.com
  Subject: Re: Numbering Rows (SEQUENCE, OID) questions
  In-Reply-To: <200112171704.fBHH47405974@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox