Re: sequences w/o holes

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "Marian Naghen" <naghen(at)ratb(dot)ro>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: sequences w/o holes
Date: 2005-12-19 09:21:58
Message-ID: 572E1574-44F1-489E-9DC6-FBB444ACD5C5@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Dec 19, 2005, at 20:14 , Marian Naghen wrote:

> Can anyones suggest some readings about implementing
> sequences w/o holes ?

Check the mailing list archives. In short, if you want to guarantee
no holes, you don't use sequences. IIRC, the process is:
1. Set up another table (foo) that holds the current value.
2. To grab a new value, increment the current value in foo and use
the current value in your insert within a transaction.

If you delete rows from your table, you'll need to do some updating
if you want to maintain having no holes.

Michael Glaesemann
grzm myrealbox com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guido Neitzer 2005-12-19 09:26:55 Re: sequences w/o holes
Previous Message Tino Wildenhain 2005-12-19 09:18:26 Re: sequences w/o holes