Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g1CHGtE07115 for ; Tue, 12 Feb 2002 12:16:55 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g1CHGvr26397; Tue, 12 Feb 2002 12:16:57 -0500 (EST) From: Bruce Momjian Message-Id: <200202121716.g1CHGvr26397@candle.pha.pa.us> Subject: Re: Sequencing Problem in Transaction.. In-Reply-To: To: Bhuvan A Date: Tue, 12 Feb 2002 12:16:57 -0500 (EST) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL96 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200202/134 X-Sequence-Number: 6562 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