A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Transaction Isolation Levels: READ UNCOMMITTED to SERIALIZABLE

College Depth 101 in the knowledge graph ☐ I know this ☆ Set as goal
2topics build on this
406prerequisites beneath it
See this on the map →
ACID PropertiesConcurrency Control in Databases+1 more→→Multi-Version Concurrency Control (MVCC)Snapshot Isolation and Write Skew Anomalies
isolation-levels anomalies dirty-read phantom-read SERIALIZABLE

Core Idea

SQL isolation levels define how much concurrent transactions can interfere: READ UNCOMMITTED allows dirty reads, READ COMMITTED prevents dirty reads but allows non-repeatable reads, REPEATABLE READ prevents both but allows phantoms, and SERIALIZABLE provides complete isolation as if transactions ran sequentially. Higher isolation prevents more anomalies but reduces concurrency and throughput.

Explainer

You already know that transactions must satisfy the ACID properties, and that isolation is the "I" — the guarantee that concurrent transactions do not interfere with each other in harmful ways. But full isolation (serializability) is expensive in practice, so SQL defines four levels that let you trade correctness guarantees for performance. Understanding these levels means understanding the specific anomalies each one permits or prevents.

A dirty read occurs when transaction T1 reads data that T2 has written but not yet committed. If T2 rolls back, T1 has acted on data that never officially existed. This is the most dangerous anomaly, and only READ UNCOMMITTED allows it — a level rarely used in practice except for rough monitoring queries where approximate data is acceptable. Moving up to READ COMMITTED, the database guarantees you only see committed data. But a new anomaly becomes possible: the non-repeatable read. Transaction T1 reads a row, T2 modifies and commits that row, and when T1 reads the same row again, it gets a different value. Your transaction sees a consistent snapshot at each statement, but not across statements.

REPEATABLE READ fixes this by guaranteeing that if you read a row, reading it again within the same transaction returns the same value. But it permits phantom reads: T1 runs a query with a WHERE clause and gets a set of rows, T2 inserts a new row that matches the same WHERE clause and commits, and when T1 re-runs the query, a new row appears that was not there before. The existing rows are stable, but the set of matching rows can change. Finally, SERIALIZABLE prevents all three anomalies — dirty reads, non-repeatable reads, and phantoms — by ensuring the result is equivalent to running the transactions one at a time.

The practical decision depends on your workload. Most production applications use READ COMMITTED (the default in PostgreSQL and Oracle) because it provides a reasonable balance: no dirty reads, good concurrency, and the anomalies it permits are manageable for most business logic. Financial calculations, inventory systems, or anything where reading stale or changing data mid-transaction could cause real harm may need REPEATABLE READ or SERIALIZABLE. The key insight is that higher isolation is not always better — it comes with costs in the form of lock contention, aborted transactions, and reduced throughput. Choose the weakest level that your application's correctness requirements can tolerate.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Binary Counters: Design and Analysis → Binary Arithmetic → Fixed-Point Number Representation → Two's Complement Representation → Overflow and Underflow Detection → Binary Adders: Half-Adders and Full-Adders → Full Adder and Carry Propagation → Carry Lookahead Adder Design → Half Adder Circuit Design → Multiplication Circuit Design → Sequential Circuit Design → Registers and Register Files → Instruction Set Architecture (ISA) → Kernel Architecture and OS Structure → System Calls and User/Kernel Mode → Processes and the Process Control Block → Process Creation: fork() and exec() → Process Termination and Resource Cleanup → Process States and State Transitions → Threads and Concurrency → The Critical Section Problem and Race Conditions → Mutual Exclusion and Locks → Concurrency Control in Databases → Transaction Isolation Levels: READ UNCOMMITTED to SERIALIZABLE

Longest path: 102 steps · 406 total prerequisite topics

Prerequisites (3)

Leads To (2)