Check out our free eBook: "Best Practices for Optimizing Postgres Query Performance"Download Now

U139: Could not serialize access due to read/write dependencies among transactions

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 read/write dependencies among transactions
DETAIL:  Reason code: Canceled on identification as a pivot, during write.
HINT:  The transaction might succeed if retried.
STATEMENT:  INSERT INTO my_table SELECT 1;

Explanation:

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

It indicates that due to the guarantees required by the SERIALIZABLE transaction level, the transaction could not be committed, and was instead rolled back.

Recommended Action:

Typically your application should automatically retry the transaction, and you can safely ignore these log notices.

Learn More:


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