Skip to content
StackDecode
System Design
4. Database FundamentalsAnimated

Isolation Levels

How much concurrent transactions can see each other's changes.

The idea

From read uncommitted to serialisable, stricter levels prevent more anomalies such as dirty and phantom reads but allow less concurrency.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

Txn 1DatabaseTxn 2UPDATE balance = 0 (uncommitted)
  • current message
  • earlier
  • failure or attack

Txn 1 changes a value but has not committed.

step:
1/5
from:
Txn 1
to:
Database
1/5

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Choose a level
  2. 2Transactions read according to it
  3. 3Anomalies are blocked or allowed
  4. 4Higher isolation lowers throughput

Where it is used

Tuning correctness against speed.

Watch out for

The default level may not be what you assume.

Related