Snapshot Isolation
ELI5 — The Vibe Check
Snapshot isolation gives each transaction a frozen-in-time photo of the database. You start a transaction, and from that moment you see a perfectly consistent world, no matter what chaos other transactions are causing. It's like taking a photo of a whiteboard before the meeting starts, you always have your clean reference.
Real Talk
Snapshot Isolation (SI) provides each transaction with a consistent view of the database as of its start time. All reads within the transaction see data from that snapshot, regardless of concurrent modifications. PostgreSQL's REPEATABLE READ level implements SI. It prevents dirty reads and non-repeatable reads but allows write skew anomalies.
When You'll Hear This
"Snapshot isolation prevents most concurrency anomalies without heavy locking." / "Use REPEATABLE READ in Postgres to get snapshot isolation."
Related Terms
MVCC
MVCC (Multi-Version Concurrency Control) is how databases let multiple users read and write at the same time without stepping on each other's toes.
Phantom Read
A phantom read is when you run the same query twice in a transaction and get different rows back because another transaction inserted or deleted matching r...
Read Committed
Read Committed is the default isolation level in PostgreSQL.
Serializable Isolation
Serializable isolation is the strictest mode where the database pretends all transactions run one after another, even though they're actually concurrent.