| From: | michele curioni <mic(dot)curioni(at)googlemail(dot)com> |
|---|---|
| To: | pgsql-sql(at)lists(dot)postgresql(dot)org |
| Subject: | Could not serialize access due to read/write dependencies among transactions |
| Date: | 2023-02-23 21:18:20 |
| Message-ID: | CAPDic7m0LvwdUtpLS03QZ_gjQ08vax-DFNRqtdmTb7yb2-467Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Hi,
we have a Spring Boot application that tries to update two separate rows in
a table in 2 separate threads, and it uses the default Transaction
Isolation level of READ_COMMITTED.
One of the two threads always succeeds, the other always fails with:
org.postgresql.util.PSQLException: ERROR: could not serialize access
due to read/write dependencies among transactions
[java] ERROR> Detail: Reason code: Canceled on identification as a
pivot, during write.
[java] ERROR> Hint: The transaction might succeed if retried.
I thought that error could only happen for SERIALIZABLE transactions, and
moreover, the two threads are trying to update different rows.
The sql update has a where clause on the primary key:
update table set status='a' where column_a = {value1} and column_b={value2}
The table's primary key is a composition of column_a and column_b
thread1 and thread2 use different values for value1 and value2
Does anyone have any idea how the problem could happen?
Thanks,
Michele
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2023-02-23 22:10:56 | Re: Could not serialize access due to read/write dependencies among transactions |
| Previous Message | Andreas Joseph Krogh | 2023-02-09 16:59:03 | Re: How to ensure a log-entry is created based on state of data in other tables |