We just released our second eBook: "The Most Important Events to Monitor in Your Postgres Logs"Download Now

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'


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:

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →