Serializability
Serializable Snapshot Isolation (SSI)
SSI is the first serializable isolation level that scales well. It is Optimistic: it assumes things will be fine but checks for trouble at commit time.
How it works
The database tracks two things:
- Detecting reads of stale MVCC versions: When a transaction commits, it checks if any of the values it read have since been updated.
- Detecting writes that affect prior reads: When a transaction writes, it checks if any other active transaction has read that row.
If the database finds a potential "Write Skew" cycle, it aborts one of the transactions.
- Pros: No locking! Readers don't block writers. High concurrency.
- Cons: Abort rate can be high if there is heavy contention.
Knowledge Check
Which of these is an OPTIMISTIC concurrency control strategy?
Two-Phase Locking (2PL)
Serializable Snapshot Isolation (SSI)
Single-threaded execution