Interview replay

Full round replay — isolation levels

10 minintermediate115 yrs

Timed verbal replay with pass/fail criteria per follow-up.

How to run this

Answer out loud, timed. Do not read the entry first. Then compare against "The Answer" and "Interviewer's Next Move" and mark yourself.

The opener

What are the isolation levels, and what does each permit?

Budget: 45 seconds. Going long here is itself a fail signal.

Follow-ups

  1. 1. “What does ACID stand for, and which letter is negotiable?

    Testing: Whether they see isolation as the dial.

    Scoring

    Pass: Atomicity, consistency, isolation, durability. Isolation is the only one with levels — every level below serializable is buying throughput by permitting an anomaly. The others you either have or you do not.

    Fail: Recites the acronym with no view on which part varies.

  2. 2. “Difference between a non-repeatable read and a phantom?

    Testing: A distinction people blur.

    Scoring

    Pass: A non-repeatable read is the same row changing value between two reads. A phantom is the set of rows changing — a new row appearing in a range already scanned. It matters because locking the rows you read cannot stop a row you have not seen from appearing.

    Fail: Treats them as the same thing, or cannot say why the difference matters.

  3. 3. “Which level does your database default to?

    Testing: Whether they have ever checked.

    Scoring

    Pass: PostgreSQL, Oracle and SQL Server default to read committed. MySQL InnoDB defaults to repeatable read. Worth knowing exactly, because a team moving between them gets different behaviour with no code change.

    Fail: Says everyone defaults to read committed, or does not know.

  4. 4. “Does repeatable read permit phantom reads?

    Testing: Standard versus implementation.

    Scoring

    Pass: By the standard, yes. PostgreSQL's repeatable read is snapshot isolation and prevents them. The standard states the minimum each level must prevent, not a ceiling — implementations are free to be stricter, and it is worth saying both halves.

    Fail: Gives only the textbook answer, or only the PostgreSQL answer.

  5. 5. “Two transactions each add 50 to a balance of 100, both commit, the balance is 150. Which anomaly?

    Testing: The one that is not in the table.

    Scoring

    Pass: None of the three. Both read committed data, read it once, and wrote a value derived from it. It is a lost update, which the standard's table does not cover and read committed permits everywhere.

    Fail: Names dirty read or non-repeatable read.

  6. 6. “So does raising the isolation level fix it?

    Testing: Whether they know it is not portable.

    Scoring

    Pass: Not reliably. PostgreSQL's repeatable read detects the write-write conflict and aborts; MySQL InnoDB's does not. Fix the operation instead — do the arithmetic in one statement, or take the row lock with SELECT FOR UPDATE, or use a version column and retry.

    Fail: Says serializable and stops there.

  7. 7. “You set serializable. What have you actually bought?

    Testing: The obligation that comes with it.

    Scoring

    Pass: Visibility, not correctness. Conflicting transactions abort, and the application must retry the whole transaction with backoff and jitter. Without a retry you have swapped silent corruption for user-facing errors and gained nothing.

    Fail: Believes serializable makes the code correct by itself.

  8. 8. “What is write skew?

    Testing: The case serializable exists for.

    Scoring

    Pass: Two transactions read overlapping rows, each checks an invariant that still holds, and each writes a different row — so neither sees the other's write and the invariant breaks. Two on-call engineers each confirming someone else is on duty, then both going off. Snapshot isolation permits it; serializable does not.

    Fail: Has not heard of it, or confuses it with a lost update.

  9. 9. “When would you raise the level, then?

    Testing: Where the level IS the tool.

    Scoring

    Pass: When the problem is read consistency — a report reading many tables that must agree with each other wants one snapshot, which is exactly what repeatable read gives. Scope it to that transaction, never globally.

    Fail: Raises it globally, or never.

  10. 10. “Why not just set the whole application to serializable?

    Testing: Judgement about blast radius.

    Scoring

    Pass: It changes behaviour for every query written by someone assuming read committed, and under contention the abort rate can look like an outage. Raise it on the specific transactions with invariants across rows, and give those a retry policy.

    Fail: Sees no downside.

  11. 11. “Your test passes on H2 and fails on PostgreSQL. Why?

    Testing: Portability of isolation.

    Scoring

    Pass: Isolation is among the least portable parts of SQL — defaults differ, implementations differ, and H2 will accept a level it does not enforce the way production does. Run the real engine and version in tests.

    Fail: Assumes an in-memory database behaves the same.

Score yourself

11/11 — you can choose a level and defend it in a design review 8-10 — solid; the lost-update and write-skew answers are where points go 5-7 — you know the table but not what it leaves out; redo the Production tier 0-4 — reproduce the four anomalies yourself before reading anything

← Back to What are the isolation levels, and what does each permit?