The four SQL isolation levels
coreintermediateAn isolation level is a rule that decides how much one transaction can see of another transaction's uncommitted or concurrent work. The four standard levels — Read Uncommitted, Read Committed, Repeatable Read, Serializable — trade correctness for concurrency: each stricter level rules out more anomalies, at the cost of more locking or more retried transactions.
Think of it as
Isolation levels are like how much privacy a shared kitchen gives simultaneous cooks. Read Uncommitted lets you taste a dish another cook is still stirring, before they decide it needs salt. Read Committed only lets you taste what they've actually plated. Repeatable Read guarantees the dish you tasted once won't have changed if you taste it again mid-meal. Serializable acts as if only one cook were in the kitchen at a time, even though several really are.
What we're doing: Show the same query at Read Committed vs Repeatable Read returning different results.
- 2
- Transaction A takes its first read under Read Committed.
- 9
- The second read within the same transaction sees a different value — the non-repeatable read Read Committed allows.
- 13
- Repeatable Read would keep returning 100 for the rest of this transaction, from its fixed snapshot.
Why this works: The exact same two queries return different results purely based on isolation level — this is the concrete behavior the four levels differ on, not an abstract distinction.
Assuming the database's default isolation level is Serializable
Wrong
Better
What you see: Two requests reading the same row twice within a transaction get different values, or a filtered query returns different row counts across two reads in the same transaction — surprising behavior for a team that assumed "transaction" alone meant full isolation.
Why: Read Committed is the default in PostgreSQL, Oracle and SQL Server; only MySQL/InnoDB defaults to Repeatable Read. None of them default to Serializable, because it is the most expensive level to run under real concurrency.
- Txn A → accounts: SELECT balance (reads 100)
- Txn B → accounts: UPDATE + COMMIT (balance = 150)
- Txn A → accounts: SELECT balance again (reads 150 — non-repeatable read)
Isolation levels and the anomalies each one prevents
Together
Remember: Four levels, each removing more anomalies: Read Uncommitted (dirty reads possible) → Read Committed (default in most databases) → Repeatable Read (a value stays stable) → Serializable (behaves like one transaction at a time).
See also: concurrency anomalies · optimistic vs pessimistic

