Skip to content
uencoder

Isolation Level

Isolation levels define visibility between concurrent transactions, from read uncommitted to serializable; higher levels give stronger consistency but lower concurrency.

Purpose

To balance concurrency performance against consistency and choose an appropriate isolation level.

Mechanism

Read uncommitted (dirty reads), read committed (non-repeatable reads), repeatable read (phantom reads), serializable (no anomalies). MVCC implements snapshot isolation (between repeatable read and serializable). PostgreSQL defaults to read committed; MySQL InnoDB to repeatable read.

Use cases

  • Concurrent transaction consistency control
  • Read committed to avoid dirty reads
  • Repeatable read for report consistency
  • Serializable strong consistency

Examples

  • Input
    SET TRANSACTION ISOLATION LEVEL READ COMMITTED
    Output
    Avoids dirty reads

    PostgreSQL default

Common errors

Low isolation levels cause non-repeatable/phantom reads
Choose the isolation level per business needs

Related terms

References