Reading A Frozen World
Under snapshot isolation a transaction sees the database as it existed at a single point in time, ignoring changes from transactions that commit later. Readers never block writers and writers never block readers, because each reader looks at the appropriate version of every row.
How Versions Work
Multiversion concurrency control keeps multiple versions of a row, each stamped with the transaction that created it and, once superseded, the one that replaced it. The old versions live in the undo log or in the table itself.
The Snapshot
When a transaction starts its read view, it captures a list of which transactions had already committed. For any row it visits, it walks the version chain and picks the newest version whose creating transaction is in that committed set.
- A version created by a still active transaction is invisible.
- A version created after the snapshot is invisible.
- The first version satisfying the snapshot is the one read.
Write Conflicts
If two snapshots both update the same row, the second to commit detects the conflict and aborts, the first committer wins rule, which keeps lost updates from slipping through.
Key idea
Snapshot isolation gives each transaction a point in time view by walking row version chains and a captured committed set, so reads never block, while first committer wins resolves write conflicts.