MVCC (Multi-Version Concurrency Control) is a concurrency control technique used by databases like PostgreSQL, Oracle, MySQL InnoDB, etc.
SELECT
, you see the version of rows visible to you (i.e., those committed before your transaction started).Serializable Snapshot Isolation (SSI) is a way to achieve serializability β the strongest isolation level β without locking every read.
It's like Snapshot Isolation (MVCC-based) but with conflict detection.
If two transactions could violate serializability, one is aborted at commit.
Used in: PostgreSQL's SERIALIZABLE
isolation level.
Race Condition | MVCC Handles? | SSI Handles? | Why |
---|---|---|---|
π§Ό Dirty Read | β Yes | β Yes | MVCC never shows uncommitted data |
π Dirty Write | β Yes | β Yes | Writes are versioned; write-write conflicts abort one txn |
π Lost Update | β No | β Yes | MVCC allows read-modify-write races unless locked; SSI detects conflict and aborts |
π€Ή Read Skew (Non-Repeatable Read) | β Yes | β Yes | MVCC gives a consistent snapshot |
π² Write Skew | β No | β Yes | MVCC sees consistent state, but both txns may write conflicting data (e.g., doctor off-call); SSI aborts |
π» Phantom | β No | β Yes | MVCC canβt lock range predicates; SSI tracks predicate reads and aborts conflicting inserts |