From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Bhuvan A <bhuvansql@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sequencing Problem in Transaction..
Date: Tue, 12 Feb 2002 12:16:57 -0500 (EST)
Message-ID: <200202121716.g1CHGvr26397@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.20.0202121909070.7267-100000@Larry.bks>
Bhuvan A wrote:
>
>
> On Feb 12, Christopher Kings-Lynne wrote:
>
> > Ummm...this is not a bug - it is utterly essential that sequences are not
> > rolled back!!!
> >
> > Think about this:
> >
> > Sequence counter is 9
> > Transaction 1 gets sequence no. 10
> > Transaction 2 gets sequence no. 11
> > transaction 1 rolls back, sequence no. reset to 9
> > Transaction 3 gets sequence number 10
> > Transaction 4 gets sequence number 11 - BAM!!!
> >
> Good and Thankx!!!
Believe it or not, this _wasn't_ in the FAQ, though it certainly is
asked enough times. Added now as item 4.15.4:
4.15.4) Why aren't my sequence numbers reused on transaction abort? Why are
there gaps in the numbering of my sequence/SERIAL column?
To improve concurrency, sequence values are given out to running
transactions as needed and are not locked until the transaction
completes. This causes gaps in numbering from aborted transactions.
--
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
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, bhuvansql@yahoo.com
Subject: Re: Sequencing Problem in Transaction..
In-Reply-To: <200202121716.g1CHGvr26397@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