Code Room
System designHardsd-g033
Subject DatabasesLevel Senior–Staff~50 minCommon in Databases & SQL interviewsIndustries Technology, Software development

Question

Design the MVCC (multi-version concurrency control) layer for an OLTP database that must give readers a consistent snapshot without blocking writers, and writers without blocking readers, at SNAPSHOT ISOLATION (with an option for SERIALIZABLE). Workload: 100k tx/sec, mostly short transactions, mix of point reads/writes and some long-running analytics reads that must not stall OLTP. Describe how versions are stored and visible, how you assign transaction timestamps/IDs, how you prevent write-write conflicts, and how you reclaim dead versions. Call out the central operational hazard.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.