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.

HardTechnical
35 practiced

For each of the following anomalies: lost update, write skew, read skew, and phantom read, give a short example (SQL or pseudocode) with two concurrent operations that demonstrates it. For each anomaly, propose at least one way to prevent or mitigate it in a managed cloud database where you may not control every isolation-level or locking knob, and discuss the operational trade-offs of your approach.

EasyTechnical
33 practiced

Explain the ACID properties (Atomicity, Consistency, Isolation, Durability). For each property give a concrete example of a database operation that would break if that property were not guaranteed, and briefly describe how a typical RDBMS enforces that property.

HardTechnical
36 practiced

Production is showing an increasing frequency of deadlocks between two tables during nightly batch jobs. Describe how you would diagnose the root cause using DB diagnostics and logs, how to reproduce and test in staging, short-term mitigations to stop the incident, and long-term fixes including transaction redesign or indexing improvements.

HardTechnical
42 practiced

A high-throughput OLTP database had its isolation level raised from READ COMMITTED toward REPEATABLE READ or SERIALIZABLE, and write throughput dropped noticeably afterward. Explain why raising isolation level can cause this kind of regression, and walk through how you would diagnose and mitigate it without simply reverting the isolation change.

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.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.