Serialize transactions

Started by Ruslan A Dautkhanovover 23 years ago2 messagesbugs
Jump to latest
#1Ruslan A Dautkhanov
rusland@scn.ru

Hello all,

I have sometimes (rarely, once per some days) error during
executting different queries in PostgreSQL:
ERROR: Can't serialize access due to concurrent update

All my transactions use
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

I can't found nothing about this problem in the html-docs sql-set-transaction.html .

Why this happen? How to solve this problem?
Thanks a lot.

--
best regards,
Ruslan A Dautkhanov rusland@scn.ru

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ruslan A Dautkhanov (#1)
Re: Serialize transactions

Ruslan A Dautkhanov <rusland@scn.ru> writes:

I have sometimes (rarely, once per some days) error during
executting different queries in PostgreSQL:
ERROR: Can't serialize access due to concurrent update
All my transactions use
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

If you use serializable mode for updating transactions, you must expect
this error and deal with it (by retrying the transaction from the top).

This is discussed in the documentation, eg at
http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/transaction-iso.html#XACT-SERIALIZABLE

You might also find it useful to go through the slides from this talk:
http://conferences.oreillynet.com/cs/os2002/view/e_sess/2681

regards, tom lane