isolation level
A setting that controls how much concurrent transactions can see of each other's changes and how they may interleave.
In more detail
From weaker to stronger, the standard levels are read uncommitted, read committed, repeatable read and serializable. Stronger levels prevent more anomalies but block or abort more transactions. PostgreSQL defaults to read committed; SQLite serialises writers, which makes its transactions serializable.
Example
In this course: Fakes and in-memory stand-ins rarely imitate isolation correctly, so behaviour that depends on it must be tested against the real engine. PostgreSQL defaults to read committed, while stricter levels such as serializable prevent more anomalies at a cost.Related terms
- read committed — An isolation level where each statement sees only data committed before it began, never another transaction's unfinished changes.
- repeatable read — An isolation level where a transaction keeps seeing the same snapshot of the data for its whole life.
- serializable — The strictest isolation level, which guarantees the result is the same as if transactions had run one after another.
- lost update — A concurrency bug where two sessions read the same value, both write a result based on it, and the later write silently erases the earlier one.
- ACID — The four guarantees of a database transaction: atomicity, consistency, isolation and durability.
- transaction — A group of database changes that succeed or fail together, so the data is never left half-updated.
- database engine — The database software itself, such as PostgreSQL, MySQL or SQLite, which decides the features, SQL dialect and extensions available.
Taught in
- Isolation Levels And The Lost Update — PostgreSQL, Indexing & Relational Data Modeling
- Worked Design One: Ticket Booking, Correctness First — Scalable System Design & Distributed Architecture
- Testing With Real Databases — Automated Testing, TDD & Quality Engineering