Why it matters

For critical financial and business logic, serializable is often the safe choice. Understanding when it's needed and its cost is essential.

Advertisement

The architecture

Weaker levels permit anomalies: dirty read (RU), non-repeatable read (RC), phantom read (RR), write skew (SI).

Serializable prevents all of them. Semantics: transactions behave as if run one at a time in some serializable order.

Achieving serializableSnapshot isolationallows write skewSerializable Snapshot Isolationdetects conflictsTrue serializablee.g., 2PLSSI is Postgres's approach: SI + runtime conflict detection; abort violators
Serializable implementations.
Advertisement

How it works end to end

Two-phase locking (2PL): traditional. Take locks on all reads and writes. High overhead.

Serializable Snapshot Isolation (SSI): Postgres. SI + detect potential conflicts at runtime. Abort violating transactions.

Deterministic execution: Calvin-style. Predetermine execution order to serialize.