← Lessons

quiz vs the machine

Platinum1820

Databases

Serializable Snapshot Isolation

SSI adds conflict detection to MVCC snapshots to achieve true serializability.

6 min read · advanced · beat Platinum to climb

Snapshots Are Not Enough

Plain snapshot isolation gives each transaction a consistent view from its start time using MVCC, so reads never block writes. But snapshot isolation permits write skew, where two transactions each read a snapshot, make disjoint writes, and together violate an invariant. Serializable Snapshot Isolation, or SSI, fixes this without taking read locks.

How SSI Works

SSI tracks read write dependencies between concurrent transactions. The dangerous pattern is a structure of two consecutive rw dependencies forming a cycle, which signals a possible serialization anomaly.

  • A transaction reads a value that a concurrent transaction later overwrites, creating an rw conflict.
  • When the engine detects two such conflicts chained through a pivot transaction, it knows the schedule may be non serializable.
  • It aborts one transaction to break the dangerous structure.

Why It Is Attractive

  • Readers still never block writers, preserving MVCC performance.
  • It provides true serializability, not just snapshot isolation.
  • The cost is extra tracking and some false positive aborts, since the detection is conservative.

PostgreSQL implements SSI for its Serializable level.

Key idea

Serializable Snapshot Isolation detects dangerous read write dependency structures on top of MVCC to deliver serializability without read locks.

Check yourself

Answer to earn rating on the learn ladder.

1. What anomaly does plain snapshot isolation fail to prevent?

2. How does SSI detect a possible serialization anomaly?

3. What is a downside of SSI?