Interview Prep Zoneby CuriouserLabs

Question 4 of 5 · architect level

Serializability vs linearizability — and why the C in ACID is not the C in CAP.

🎤 Say this first

They answer different questions. Serializability is an isolation property about transactions over multiple objects: the result is equivalent to some serial execution — but any serial order will do, so it says nothing about real time. Linearizability is a consistency property about single objects: every operation appears to take effect at an instant, and that order respects real time. Combine them and you get strict serializability (Spanner, CockroachDB, FoundationDB) — 'some serial order, and it matches wall-clock order'. As for the letters: ACID's C just means your invariants hold if the transaction is written correctly — it's the application's property, arguably a filler letter. CAP's C is linearizability. Same letter, unrelated concepts.

The full picture

SerializabilityLinearizabilityStrict serializability
Scopemulti-object transactionssingle object/keymulti-object transactions
Orders bysome serial orderreal timereal time
Legal to return stale?yes (a valid serial order may be old)nono
Typical implementation2PL, SSI, MVCCconsensus/quorum per keyconsensus + a clock (TrueTime, HLC)
Seen inPostgres SERIALIZABLEetcd, ZooKeeper, DynamoDB readsSpanner, CockroachDB
  • The classic gotcha, stated concretely: a serializable database is allowed to run your read-only transaction as if it had executed an hour ago — no anomaly, no violation. If your requirement is 'I must see the payment that provably completed before my request started', serializability alone does not give it to you; you need the real-time clause.
  • Why the two are so often conflated: single-object linearizable stores (etcd) and multi-object serializable stores (Postgres) rarely appear in the same sentence, so people assume 'strong = strong'. Distinguishing scope (one key vs many) and ordering (any serial order vs real time) is the whole answer.
  • Isolation levels are the practical version of this: READ COMMITTED, REPEATABLE READ, SNAPSHOT, SERIALIZABLE — each removes anomalies (dirty read, non-repeatable read, phantom, write skew). Write skew is the one worth naming: snapshot isolation permits it (two doctors both go off-call because each read the other as on-call), which is exactly why SSI exists.
  • Cost ordering to keep in your head: snapshot < serializable < strict serializable. Spanner pays for the top of that ladder with GPS/atomic clocks and commit-wait — literally waiting out clock uncertainty. That's how expensive real-time ordering is.

🔄 Likely follow-up questions

  • Give a concrete write-skew example and explain why snapshot isolation allows it.
  • What does Spanner's commit-wait actually wait for?
  • Is a system with serializable transactions but async read replicas still serializable?