Interview Q&A · questions with model answers
Database Concurrency & Scaling Interview Questions
Part of the study plan for: Data Engineer · Site Reliability Engineer (SRE) · Backend Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked What's the difference between Read Committed and Repeatable Read in practice?
Read Committed gives each statement a fresh view of committed data; Repeatable Read gives the whole transaction one snapshot. Multi-statement reports can see inconsistent data under Read Committed.
-
When would you choose optimistic locking over SELECT … FOR UPDATE?
When conflicts are rare and the time between read and write is long or involves a human (edit forms, APIs with ETags). Pessimistic locks suit short, likely-conflicting multi-step operations.
-
What is the difference between partitioning and sharding?
Partitioning splits a table into pieces within one database server (for pruning and lifecycle management); sharding splits data across multiple database servers (for write capacity and size).
-
When should you NOT use SKIP LOCKED?
When the caller needs a specific row — seats, a particular inventory item, a user's account. SKIP LOCKED silently skips locked rows, so the request could wrongly report 'unavailable' or take a…
-
What's the difference between a deadlock and a lock wait timeout?
A deadlock is a cycle of waits that can never resolve; the database detects it and aborts a victim immediately (Postgres after deadlock_timeout). A lock wait timeout means one transaction waited too…
-
How does Postgres SERIALIZABLE differ from MySQL SERIALIZABLE?
Postgres uses Serializable Snapshot Isolation: reads don't block and conflicting transactions are aborted with SQLSTATE 40001. MySQL implements SERIALIZABLE by turning plain reads into shared-lock…