On Tue, Jun 14, 2011 at 1:30 PM, <l1(at)nym(dot)hush(dot)com> wrote:
> 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?
It's going to depend on how you define 'order'. I take it you mean
transaction commit order based on time.
sequence numbers are always *fetched* in order. however, if two
separate threads are grabbing numbers and inserting them roughly a the
same time, there could be a race to transaction commit (although I
wonder how that could possibly matter, since your app is multi
threaded and there is no distinguishing information outside of the
sequence value itself).
In response to
pgsql-novice by date
|Next:||From: Thomas Kellerer||Date: 2011-06-15 07:21:48|
|Subject: Re: SERIAL order and INSERT order|
|Previous:||From: l1||Date: 2011-06-14 18:30:36|
|Subject: SERIAL order and INSERT order|