pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed sequence numbers under pg concurrence model
3+ messages / 2 participants
[nested] [flat]
* sequence numbers under pg concurrence model
@ 2011-02-24 19:49 scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
2011-02-24 19:54 ` Re: sequence numbers under pg concurrence model Frank Heikens <frankheikens@mac.com>
0 siblings, 1 reply; 3+ messages in thread
From: scorpdaddy@hotmail.com @ 2011-02-24 19:49 UTC (permalink / raw)
To: pgsql-admin
What is the expected behaviour of sequence numbers under pg concurrence model? 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?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: sequence numbers under pg concurrence model
2011-02-24 19:49 sequence numbers under pg concurrence model scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
@ 2011-02-24 19:54 ` Frank Heikens <frankheikens@mac.com>
0 siblings, 0 replies; 3+ messages in thread
From: Frank Heikens @ 2011-02-24 19:54 UTC (permalink / raw)
To: scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>; +Cc: pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [ADMIN] sequence numbers under pg concurrence model
@ 2011-02-24 20:05 scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: scorpdaddy@hotmail.com @ 2011-02-24 20:05 UTC (permalink / raw)
To: Frank Heikens <frankheikens@mac.com>; pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-02-24 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-24 19:49 sequence numbers under pg concurrence model scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
2011-02-24 19:54 ` Frank Heikens <frankheikens@mac.com>
2011-02-24 20:05 Re: [ADMIN] sequence numbers under pg concurrence model scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
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