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

Isolation Level: SERIALIZABLE

College Depth 101 in the knowledge graph ☐ I know this ☆ Set as goal
4topics build on this
406prerequisites beneath it
See this on the map →
Concurrency Control in Databases→→Isolation Level: READ COMMITTEDIsolation Level: REPEATABLE READ
isolation concurrency strongest-level

Core Idea

SERIALIZABLE is the highest isolation level; it prevents all anomalies (dirty reads, non-repeatable reads, phantom reads) by effectively serializing transactions, though at a performance cost.

Explainer

You already know from studying concurrency control that databases offer a spectrum of isolation levels, each preventing an increasing set of anomalies. SERIALIZABLE sits at the top of that spectrum: it guarantees that the result of executing concurrent transactions is identical to some serial execution — as if the transactions ran one after another with no overlap at all. This means dirty reads, non-repeatable reads, and phantom reads are all impossible. The database might still execute transactions concurrently for performance, but it ensures the outcome is indistinguishable from a serial order.

How databases achieve this varies. Traditional implementations use strict two-phase locking (2PL): every transaction acquires locks before accessing data and holds all locks until it commits or aborts. For SERIALIZABLE, this includes predicate locks (also called range locks) that cover not just individual rows but entire ranges matching a query's WHERE clause, preventing phantom inserts. If transaction A reads "all orders where amount > 1000," a predicate lock prevents transaction B from inserting a new order with amount 1500 until A finishes. The downside is that aggressive locking increases the chance of deadlocks — situations where two transactions each wait for a lock the other holds — and reduces concurrency because transactions block each other more frequently.

Modern databases like PostgreSQL use a more sophisticated approach called Serializable Snapshot Isolation (SSI). Instead of blocking transactions with locks, SSI lets each transaction work on a consistent snapshot of the database (as in MVCC) and tracks dependencies between transactions. At commit time, the system checks whether the dependency graph contains a cycle — a pattern called a "dangerous structure" — that would make the execution non-serializable. If it detects one, it aborts one of the involved transactions, which the application must then retry. SSI achieves serializability with much less blocking than 2PL, making it practical for high-throughput systems.

The key practical consideration is when to use SERIALIZABLE. It is the right choice when your application's correctness depends on conditions that span multiple reads — for example, ensuring that a seat is not double-booked, or that an account balance never goes negative across concurrent withdrawals. In these cases, weaker isolation levels allow race conditions that produce incorrect results. The cost is that some transactions will be aborted and must be retried, so your application code must include retry logic. Many teams default to Read Committed for most operations and selectively escalate to SERIALIZABLE for the critical transactions where correctness cannot be compromised.

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 → Isolation Level: SERIALIZABLE

Longest path: 102 steps · 406 total prerequisite topics

Prerequisites (1)

Leads To (2)