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
43 practiced

Walk through the SQL isolation levels: READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, SERIALIZABLE. For each level, describe which anomalies it prevents (dirty reads, non-repeatable reads, phantom reads), and give a short SQL snippet or scenario that demonstrates one anomaly.

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.

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
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
31 practiced

What is a database transaction, and why do COMMIT and ROLLBACK matter for keeping data correct? Walk through a concrete example, such as a batch data-load job, where a transaction boundary prevents partial or inconsistent data from landing in the table.

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.