Re: auto_increment - Mailing list pgsql-sql

From Christopher Browne
Subject Re: auto_increment
Date
Msg-id m365jnd0gc.fsf@wolfe.cbbrowne.com
Whole thread Raw
In response to Re: auto_increment  ("Muhyiddin A.M Hayat" <middink@indo.net.id>)
List pgsql-sql
In the last exciting episode, middink@indo.net.id ("Muhyiddin A.M Hayat") wrote:
> Ok, but if i do rollback, the auto_increment don't roolback.

Right, it's not supposed to.

Think about the situation where you have 5 clients connecting to the
database and adding records to this table.

The current functionality of sequences means that with a little
cacheing of values, they can all be hammering the table with inserts
and never need to worry about what the other is doing.

If the increment was rolling back by one when an INSERT was rolled
back, that would mean that the cache size was just 1, and access to
that sequence would have to be serialized across all accessors, which
would slow it down incredibly.
-- 
(format nil "~S@~S" "cbbrowne" "ntlug.org")
http://www3.sympatico.ca/cbbrowne/oses.html
"Let me blow that up a bit more for you."
-- Colin Powell, Discussing a picture of the intelligence compound in  Iraq


pgsql-sql by date:

Previous
From: "Martin Kuria"
Date:
Subject: sub query
Next
From: Peter Eisentraut
Date:
Subject: Re: sub query