Academy · Consistency & Consensus

Isolation levels & write skew

Run transactions concurrently for speed and they corrupt each other in subtle ways.

2 min read·8 sections
Open the interactive version → diagrams, practice & more

The problem

Run transactions concurrently for speed and they corrupt each other in subtle ways.

The idea

Isolation levels define which anomalies (dirty reads, lost updates, write skew) are allowed. Serializable is the gold standard.

How it works

Read Committed → Repeatable Read → Snapshot Isolation → Serializable, each forbidding more anomalies. Snapshot Isolation prevents most but allows write skew (two txns read an overlapping set, write different rows, break an invariant). Serializable Snapshot Isolation closes that gap.

The tradeoff

Stronger isolation = more blocking/aborts = less concurrency. Most apps run at Read Committed and don't realize the risks.

In the wild

Postgres SERIALIZABLE uses SSI; "is Snapshot Isolation serializable?" is a classic interview trap (no — write skew).

Deep dive

Flow

  1. List the invariant each transaction must preserve.
  2. Pick the weakest level that still protects it.
  3. Use Snapshot Isolation so readers don't block writers.
  4. Escalate to Serializable (SSI) where write skew can break the invariant.

Watch for

  • Snapshot Isolation allows write skew despite feeling "safe".
  • Read Committed (most defaults) permits lost updates and non-repeatable reads.
  • Stronger isolation = more aborts/retries — handle them.

Common trap

Answer the trap: Snapshot Isolation is NOT serializable — name write skew as the gap.

Common questions

What problem does Isolation levels & write skew solve?

Run transactions concurrently for speed and they corrupt each other in subtle ways.

How does Isolation levels & write skew work?

Read Committed → Repeatable Read → Snapshot Isolation → Serializable, each forbidding more anomalies. Snapshot Isolation prevents most but allows write skew (two txns read an overlapping set, write different rows, break an invariant). Serializable Snapshot Isolation closes that…

What are the tradeoffs of Isolation levels & write skew?

Stronger isolation = more blocking/aborts = less concurrency. Most apps run at Read Committed and don't realize the risks.

Where is Isolation levels & write skew used in production?

Postgres SERIALIZABLE uses SSI; "is Snapshot Isolation serializable?" is a classic interview trap (no — write skew).

Part of Academy on SystemLore — system design explained with 148 deep topics, interactive diagrams, and a build-it-yourself game. Browse the glossary and "X vs Y" comparisons, or build this one →