Explain ACID and transaction isolation levels
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Meta's system design round, last asked Dec 2025. It tests databases, transactions and isolation levels.
Explain what a database transaction is and what each ACID property (atomicity, consistency, isolation, durability) guarantees. Then walk through the standard isolation levels (read uncommitted, read committed, repeatable read and serializable): which anomalies each one allows or prevents, a concrete scenario for each anomaly, and when you would choose each level in a real application. Finish with how isolation trades off against performance and concurrency.
Requirements
- A transaction as a unit of work that commits or rolls back as a whole, and each ACID letter in one or two precise sentences.
- The anomalies: dirty read, non-repeatable read, phantom read, and also lost update and write skew.
- A table of which levels allow which anomalies, with a concrete two-transaction timeline for each anomaly (for example two transfers out of one bank account).
- When to use each level: a financial ledger or seat booking versus an analytics dashboard versus a typical web app.
- How databases implement isolation (locks, MVCC snapshots, serializable snapshot isolation) and what that costs in throughput, blocking, deadlocks and retries.
Clarifying questions
- A specific database (PostgreSQL, MySQL InnoDB), or the SQL standard's definitions?
- Is the focus on a single node, or on a distributed database as well?
- Should I cover how to choose a level in application code (per transaction versus global default)?
What a strong answer covers
- Correct definitions, including that consistency means the database moves between states that satisfy its constraints, which depends on the application as much as the database.
- Read uncommitted: dirty reads possible; rarely used. Read committed: no dirty reads, but a row can change between two reads in one transaction; the default in many databases. Repeatable read: rows already read stay the same, though phantoms are allowed by the standard (and prevented by snapshots in some databases). Serializable: equivalent to some serial order.
- Lost update and write skew, and why snapshot isolation alone does not prevent write skew (two doctors both going off call).
- Practical tools beyond levels:
SELECT ... FOR UPDATE, optimistic version checks, unique constraints. - The performance cost: more locking or more aborted transactions at stronger levels, and the need for retry logic.
- Choices by workload: serializable or explicit locks for money movement and booking, read committed for most web traffic, snapshot reads for long analytics queries.
Follow-ups
- Two users book the last seat at the same moment. Show how your design prevents a double booking.
- What does a serialization failure look like to the application, and how should it react?
- How does MVCC let readers avoid blocking writers?
- What changes when the data is spread across several shards?
Where it's asked
- Meta · System design · Last asked Dec 202545 min · Design discussion; either an LLM-agent system or a classic product system · Nominally AI-enabled, but the assistant is often not used
What it tests
databases · transactions · isolation levels
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
