Transactions, isolation and locking interview questions

ACID, isolation levels as PostgreSQL implements them, lost updates and write skew, row locks, MVCC, deadlocks and retries.

5 quick facts

– interview-ready · 14 questions in this topic

– of 14 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. Write skew under REPEATABLE READPredict
  2. What ACID really promisesPick the fix
  3. Isolation levels in PostgreSQLPick the fix
  4. The lost update problemFill the blank
  5. SELECT FOR UPDATE and SKIP LOCKEDFill the blank
  6. Optimistic vs pessimistic lockingPick the fix
  7. Retrying serialization failuresSpot the bug
  8. MVCC, dead tuples and VACUUMPredict
  1. Deadlocks and lock orderingSpot the bug
  2. Why long transactions hurtPick the fix
  3. Errors inside a transactionPredict
  4. Advisory locksPredict
  5. Where transactions begin and end in codeOrder the steps
  6. Two-phase commit and why services avoid itPick the fix

Practise this topic

Flashcards · 19

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 14 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 2 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Fix this PR · 2 reviews

Review a diff like a senior: flag the lines you'd comment on. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.

Sources: Topic outline informed by System Design Primer by Donne Martin and the Zalando RESTful API Guidelines, both licensed under CC BY 4.0. Every question and answer is written by Best Latest Apps. Credits and license