From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Erik Pearson" <erik(at)cariboulake(dot)com> |
Cc: | "Doug McNaught" <doug(at)wireboard(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Sequences in transaction context |
Date: | 2001-06-06 05:32:42 |
Message-ID: | 22489.991805562@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Erik Pearson" <erik(at)cariboulake(dot)com> writes:
> Thanks for the reply! I'm afraid I didn't test this thoroughly. I noticed
> that nextval changed the sequence for all transactions, and assumed that
> currval simply translated to the (nextval() - 1), which it does not, as I
> now understand it.
No. Each backend process caches the last nextval() result it got for
every sequence object it's ever nextval'd, and this data is what
currval() consults. That's the only way to ensure cross-process
consistency. What you see in currval is the last value you obtained,
regardless of what anyone else is doing.
> One last followup question -- what's MVCC?
Multi-version concurrency control. See
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/mvcc.html
or my slides on Postgres' transaction model at
http://www.ca.postgresql.org/osdn/index.html
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-06-06 05:46:41 | Re: Re[2]: How to Alter tables with ARRAY? Help PLease |
Previous Message | Tom Lane | 2001-06-06 05:25:06 | Re: Alternate database locations |