SERIALIZABLE is the strictest transaction isolation level: concurrent transactions must behave as though they ran in some serial order. PostgreSQL uses Serializable Snapshot Isolation (SSI) to detect dangerous read/write dependencies instead of relying on blocking explicit locks. section 6.9
A tempting synchronization strategy is to lock objects explicitly. That can make sessions block one another, increasing query duration, latency, and interactive waits. SERIALIZABLE avoids that blocking model, but applications must tolerate serialization failures and retry the affected transaction. section 6.13 section 6.9
Detecting write skew
Transaction T1 reads three rows where active = true. Transaction T2 deactivates one row, and T1 then calculates an average over active rows, now seeing only two. This predicate-read write skew forms an anti-dependency cycle, also called a G2 serialization anomaly. Under SERIALIZABLE, PostgreSQL detects the conflict and may raise ERROR: could not serialize access due to read/write dependencies among transactions; retry the transaction rather than treating the error as a successful result. section 6.9
Use SERIALIZABLE when synchronization correctness matters and the application can retry failed transactions:
- Prefer it over broad explicit locking when blocking and lock-management complexity would hurt latency. section 6.13 section 6.9
- Expect slightly reduced concurrency from anomaly detection, balanced against the absence of query blocking. section 6.9
- Keep retry handling in the client, or consider PostgreSQL advisory locks when synchronization belongs in application-controlled coordination. section 6.9


