Systems & Backend

Serializable Isolation

The strictest isolation level: transactions behave as if run one at a time, ruling out all concurrency anomalies.

Serializable isolation is the strongest transaction isolation level: the database guarantees the result of running transactions concurrently is identical to some order of running them one at a time. It rules out every concurrency anomaly — dirty reads, non-repeatable reads, phantoms, and write skew.

Worked example: two transactions that would together violate a business rule (both reading “only one doctor on call” and both going off-call) are prevented — under serializable, one is aborted, preserving correctness that weaker levels like snapshot isolation allow to slip through. Gotcha: serializability is the safest and the slowest — it needs either heavy locking or optimistic conflict detection that aborts and retries transactions — so databases default to weaker levels; use serializable only for the transactions whose correctness truly demands it.