SERIAL order and INSERT order - Mailing list pgsql-novice

From l1@nym.hush.com
Subject SERIAL order and INSERT order
Date
Msg-id 20110614183036.58B4314DBCF@smtp.hushmail.com
Whole thread Raw
Responses Re: SERIAL order and INSERT order  (Merlin Moncure <mmoncure@gmail.com>)
Re: SERIAL order and INSERT order  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-novice
Hi

I have a table defined as follows:

CREATE TABLE mytable (
   seqnumber BIGSERIAL;
   ...
)

and I have multiple threads inserting into the table.

If multiple threads insert at the same time, will the sequence
numbers generated always appear in the table in order?

e.g.
thread 1 does INSERT getting serial number 1
thread 2 does INSERT getting serial number 2

and both complete successfully (no rollbacks).

Are there any cases where an observer might see a row with serial
number 2 but not yet see serial number 1, perhaps because thread 1
hasn't completed its insert yet?  For example SELECT * WHERE
seqnumber < 3; would return only a row with seqnumber=2?

thanks


pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Passing the table name as a function argument in PLPGSQL
Next
From: Merlin Moncure
Date:
Subject: Re: SERIAL order and INSERT order