Explain like I'm five · Database

What is Transaction Isolation Level?

Isolation levels and anomalies, told as a story about a packer and a driver touching the same box at once.

changing the box count to 10wait, that's not the number I just sawwhen two people touch one box at once, each sees a different count

A packer and a driver touch the same box at the same time.When two people touch one box at once, each sees a different count.

dirty readnon-repeatablephantom readwith no rules for simultaneous work, three kinds of read errors happen

With no rules for simultaneous work, three kinds of read errors happen.Dirty reads, non-repeatable reads, and phantom reads.

readwritereadwriteisolation level = the rule for how strictly to keep simultaneous work apartthe stricter the rule, the safer the numbers, but work can slow down

Isolation level is the rule for how strictly to keep simultaneous work apart.The stricter the rule, the safer the numbers, but work can slow down.

Block dirty readscan't see a value before it's confirmed
Guarantee the same valuere-reading gives the same value
Block phantom readsblocks newly inserted rows too
Process one at a timethe strictest — serializable
four SQL-standard isolation levelsread uncommitted — sees everything, dirty reads allowedloosestread committed — reads only confirmed writesblocks dirty readsrepeatable read — same value on re-readblocks non-repeatable readsserializable — as if done one at a timestrictest

The SQL standard defines four isolation levels.Serializable is the strictest.

serializable: safestbut the next person may wait longerso pick the isolation level that fits the safety and speed the work needs

Serializable is safest, but the next person may wait longer than at lower levels.So pick the isolation level that fits the safety and speed the work needs.

In one breath

Isolation level decides, when several people touch the same data at once, how much of each other's work they can see.

Transaction isolation levels — Read Uncommitted, Read Committed, Repeatable Read, Serializable — allow progressively fewer anomalies (dirty read, non-repeatable read, phantom read) as they get stricter. Stronger isolation means higher consistency but can lower concurrent throughput.

When grown-ups say it

Dirty Read
Seeing a value that isn't confirmed yet. By the SQL standard, allowed only at read uncommitted.
Non-repeatable Read
Re-reading the same thing gives a different value. Blocked from repeatable read onward.
Phantom Read
A row that wasn't there shows up on re-query. By the SQL standard, fully blocked at serializable. Some products, like PostgreSQL, block it at repeatable read too.
Serializable
The level that makes simultaneous work look done one at a time. Strictest, and usually the slowest under concurrent work.
ACID
The four promises a receipt keeps. Isolation is one of the four. → the four promises a receipt keeps
Concurrency Control
How isolation levels actually get enforced. Implemented with locks or MVCC. → the no-collision rule
CAP Theorem
A trade-off story from the SRE field. Covers the limits of consistency itself in distributed settings. → the CAP theorem
Eventual Consistency
Copies differ for now, but eventually match. A different distributed-systems compromise from isolation levels. → eventual consistency
Next story
The Warehouse That Opens Its Door and Links Its Tags →
Want another term as a picture book? Request →