Serialization Failure
Error message
could not serialize access due to concurrent update
Quick summary
Under SERIALIZABLE isolation, the database detected a conflict between concurrent transactions and aborted one to maintain correctness.
Why this happens
Two concurrent transactions modify overlapping data under SERIALIZABLE isolation
High contention on the same rows
The application does not retry transactions on serialization failures
Minimal example
-- Two concurrent transactions under SERIALIZABLE
-- both try to update the same row
BEGIN ISOLATION LEVEL SERIALIZABLE;
UPDATE accounts SET balance = balance + 100 WHERE id = 1;
COMMIT; -- may fail with serialization failure-- Retry on serialization failure
BEGIN ISOLATION LEVEL SERIALIZABLE;
UPDATE accounts SET balance = balance + 100 WHERE id = 1;
COMMIT;
-- If it fails: wait briefly and retry the whole transactionSerialization failures are expected under SERIALIZABLE isolation. The application should retry the transaction.
How to diagnose
Check the isolation level of the transaction
Identify the conflicting concurrent transactions
Check if the application handles serialization failures with retries
How to fix
Retry the transaction — serialization failures are expected and retriable
Use a lower isolation level (READ COMMITTED) if serializable is not required
Reduce contention by redesigning the transaction to touch fewer rows
How to prevent
Implement retry logic for transactions under SERIALIZABLE isolation
Use the lowest isolation level that meets your correctness requirements
Keep transactions short to reduce the chance of conflicts
Related Resources
Related Glossary
Related Lessons
- ACID Properties
Learn about isolation levels.