Re: Sequencing Problem in Transaction.. - Mailing list pgsql-sql

From Bruce Momjian
Subject Re: Sequencing Problem in Transaction..
Date
Msg-id 200202121716.g1CHGvr26397@candle.pha.pa.us
Whole thread Raw
In response to Re: Sequencing Problem in Transaction..  (Bhuvan A <bhuvansql@yahoo.com>)
List pgsql-sql
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/SERIALcolumn?     To improve concurrency, sequence values are given out to running  transactions as needed and
arenot 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,
Pennsylvania19026
 



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Storing text data in databases.
Next
From: "Andrew G. Hammond"
Date:
Subject: Re: SQL request to retrieve the type of columns