Notice: We've updated our Privacy Policy, effective November 14, 2024.

U138: Could not serialize access due to concurrent update

Category: Application / User Errors
SQLSTATE: 40001 (Class 40 - Transaction Rollback: serialization_failure)
Urgency: low

Example Postgres Log Output:

ERROR: could not serialize access due to concurrent update
STATEMENT: UPDATE my_table WHERE id = 123 SET my_column = 'test'

Explanation:

This log event only occurs when using the REPEATABLE READ isolation level, not with the default READ COMMITTED isolation level.

It indicates that the UPDATE or DELETE statement was queued behind another UPDATE/DELETE statement on the same row. That other statement finished, and due to the guarantees of the REPEATABLE READ isolation level, the statement in this session was cancelled.

Recommended Action:

Typically your application should automatically retry the UPDATE or DELETE when seeing this error message, whilst taking the updated state of the row into account.

Learn More:


Download Free eBook: The Top 6 Postgres Log Events
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →