Re: Sequences in transaction context
От | Tom Lane |
---|---|
Тема | Re: Sequences in transaction context |
Дата | |
Msg-id | 22489.991805562@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | RE: Sequences in transaction context ("Erik Pearson" <erik@cariboulake.com>) |
Список | pgsql-general |
"Erik Pearson" <erik@cariboulake.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
В списке pgsql-general по дате отправления: