| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | michele curioni <mic(dot)curioni(at)googlemail(dot)com> |
| Cc: | pgsql-sql(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Could not serialize access due to read/write dependencies among transactions |
| Date: | 2023-02-23 22:10:56 |
| Message-ID: | 719366.1677190256@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
michele curioni <mic(dot)curioni(at)googlemail(dot)com> writes:
> 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,
Indeed. I think you're mistaken to claim that the transactions are
running in READ COMMITTED.
> moreover, the two threads are trying to update different rows.
That part's not so hard to explain: serializable mode's tracking of
which rows received updates is a bit lossy. It might be complaining
just because the updated rows were on the same page.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | nikhil raj | 2023-02-25 20:35:22 | Take the data from table and rotate the member on every 7th day or starting day of the week and continue for whole week continue till the date range |
| Previous Message | michele curioni | 2023-02-23 21:18:20 | Could not serialize access due to read/write dependencies among transactions |