From: scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
To: Frank Heikens <frankheikens@mac.com>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: [ADMIN] sequence numbers under pg concurrence model
Date: Thu, 24 Feb 2011 16:05:39 -0400
Message-ID: <BLU0-SMTP2079F8D94D338173DE7B63FCEDA0@phx.gbl> (raw)
Wicked! Great answer. Thanks.
----- Reply message -----
From: "Frank Heikens" <frankheikens@mac.com>
Date: Thu, Feb 24, 2011 3:54 pm
Subject: [ADMIN] sequence numbers under pg concurrence model
To: "scorpdaddy@hotmail.com" <scorpdaddy@hotmail.com>
Cc: "pgsql-admin@postgresql.org" <pgsql-admin@postgresql.org>
Op 24 feb 2011, om 20:49 heeft scorpdaddy@hotmail.com het volgende geschreven:
> What is the expected behaviour of sequence numbers under pg > concurrence model?
From the manual:
Important: To avoid blocking concurrent transactions that obtain numbers from the same sequence, a nextval operation is never rolled back; that is, once a value has been fetched it is considered used, even if the transaction that did the nextval later aborts. This means that aborted transactions might leave unused "holes" in the sequence of assigned values. setval operations are never rolled back, either.
http://www.postgresql.org/docs/current/static/functions-sequence.html> E.g. Uncommitted transaction 1 in progress has inserted 5 tuples > into table foo. Meanwhile uncommitted transaction 2 in progress > inserts 100 tuples into table foo. If the sequence number for the > pk started at 1000 before these transactions, what are the sequence > numbers for transaction 1, 2, and the final sequence number if they > both commit? One rollback's? Both rollback? One hangs open while > the other commits? One hang and one rollback's?
>
Frank Heikens
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: scorpdaddy@hotmail.com, frankheikens@mac.com
Subject: Re: [ADMIN] sequence numbers under pg concurrence model
In-Reply-To: <BLU0-SMTP2079F8D94D338173DE7B63FCEDA0@phx.gbl>
References: <BLU0-SMTP2079F8D94D338173DE7B63FCEDA0@phx.gbl>
* 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