Transactions, Concurrency Control, and Isolation Levels Questions

How a database engine manages concurrent access from multiple transactions: ACID guarantees (atomicity, consistency, isolation, durability), the standard isolation levels (read uncommitted, read committed, repeatable read, serializable) and the anomalies they permit or prevent (dirty reads, non-repeatable reads, phantom reads, lost updates, write skew), pessimistic locking versus optimistic concurrency control, deadlock detection and handling (including a single transaction that holds locks across more than one shard), and choosing an isolation level for a given workload (for example OLTP writes versus reporting reads). Also covers MVCC as the mechanism that delivers these guarantees, including snapshot isolation versus true serializability and the version cleanup (vacuum) MVCC requires to control table and index bloat from old row versions. Does not cover correctness across separate databases or services, such as two-phase commit, distributed consensus, or replication and sharding topology design.

MediumTechnical
42 practiced

Describe how PostgreSQL's MVCC mechanism works, including how transaction IDs and snapshots determine what a query can see, and why this design causes table and index bloat over time. How would you detect bloat in a production database, and what remediation options are available? Compare their operational trade-offs.

HardTechnical
34 practiced

Snapshot isolation (SI) prevents some anomalies but can still allow write skew. Explain why, then walk through a concrete example with two concurrent transactions in a banking-like system where SI lets a business invariant get silently violated. Propose strategies to prevent or catch this when the invariant is critical.

EasyTechnical
32 practiced

List the four standard SQL isolation levels (read uncommitted, read committed, repeatable read, serializable) and for each, state which of the classic anomalies (dirty read, non-repeatable read, phantom read, write skew) it still permits. Which isolation level does PostgreSQL actually provide by default, and what does that guarantee in practice for a reader running concurrently with writers?

HardTechnical
43 practiced

Analyze the performance and correctness trade-offs between running read-only transactions under snapshot isolation versus serializable isolation for a high-throughput analytical workload. Discuss MVCC snapshot management, stale reads, why serializable transactions need predicate locking or conflict tracking, and the runtime and memory overhead that adds. Recommend which isolation level to use, and when it is reasonable to relax the guarantee.

HardTechnical
39 practiced

Explain how Multi-Version Concurrency Control (MVCC) works internally and how snapshot isolation differs from true serializability. Describe an example of a write-skew anomaly and how you would prevent it in a DBMS that provides snapshot isolation.

Unlock Full Question Bank

Get access to all 25 Transactions, Concurrency Control, and Isolation Levels interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.