What Are Database Isolation Levels?
Isolation levels control how much one transaction's in-progress changes are visible to other concurrently running transactions, trading consistency guarantee...
Published November 19, 2026
Isolation levels control how much concurrent transactions can see of each other's changes. From weakest to strongest: Read Uncommitted, Read Committed, Repeatable Read and Serializable; stronger levels prevent more anomalies but reduce concurrency.
The concept
Dirty read: seeing uncommitted data. Non-repeatable read: a row changes between two reads. Phantom read: new rows appear between two queries.
Read Committed (PostgreSQL default) prevents dirty reads; Repeatable Read (MySQL InnoDB default) also prevents non-repeatable reads; Serializable prevents all.
What each level prevents
Practical examples
Set per transaction
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;Check the default
SELECT @@transaction_isolation; -- MySQL
SHOW transaction_isolation; -- PostgreSQLLock a row to avoid races
SELECT * FROM stock WHERE id = 1 FOR UPDATE;Common mistakes
- Using Serializable everywhere and causing contention.
- Relying on Read Committed for read-then-write logic without locks.
- Not retrying serialization failures.
Key takeaways
- Higher isolation = fewer anomalies, less concurrency.
- Know your database default.
- Retry on serialization errors.
FAQ
What is MVCC?
Multi-version concurrency control: readers see snapshots without blocking writers.
Which level should I use?
The default for most apps; raise it for critical sections.