Database questions in senior interviews go well beyond writing SQL queries. Interviewers want to understand how you reason about indexing strategies, transaction isolation levels, and the trade-offs between different storage engines. Can you explain why a B-tree index helps range queries but not arbitrary substring searches?
These 17 questions cover the database concepts that matter most in production systems: ACID guarantees, locking and concurrency control, normalization trade-offs, replication strategies, and query optimization. The kind of knowledge that separates engineers who use databases from engineers who understand them.
ACID is an acronym for four properties that guarantee reliable processing of database transactions: Atomicity, Consistency, Isolation, and Durability.
Read full answer →A database index is an auxiliary data structure, maintained separately from the table, that allows the query engine to locate rows matching a predicate without scanning every row. The canonical implementation is a B-tree (balanced tree), which keeps keys in sorted order and allows O(log n) lookup…
Read full answer →A clustered index determines the physical storage order of rows in the table. The leaf nodes of a clustered B-tree are the actual data rows themselves -- the index and the table are one structure. Because there is only one physical ordering, a table can have only one clustered index. In SQL Serve…
Read full answer →Database isolation levels define how and when the changes made by one transaction become visible to other concurrent transactions. SQL defines four standard levels, each preventing an additional set of read anomalies at the cost of greater contention.
Read full answer →Database normalization is the process of structuring a relational schema to reduce data redundancy and eliminate update anomalies. The motivation: storing the same fact in multiple places means updates must happen in multiple places -- miss one, and the database becomes inconsistent. Normalizatio…
Read full answer →PostgreSQL's MVCC, WAL, and VACUUM form an interlocking system. Understanding how they interact is essential for diagnosing performance problems in production.
Read full answer →Database sharding is horizontal partitioning of data across multiple independent database nodes (shards), each owning a subset of the dataset. Unlike vertical scaling (bigger hardware) or read replicas (copies), sharding distributes both reads and writes, enabling scale beyond what a single node …
Read full answer →A read replica is a database instance that maintains a continuously updated copy of a primary (writer) instance and serves read-only queries. The primary streams its write-ahead log (WAL) or binlog to replicas, which apply the changes asynchronously — or synchronously in the case of synchronous r…
Read full answer →A covering index is an index that contains every column referenced in a query — in the SELECT list, WHERE clause, ORDER BY, and JOIN conditions — so the database engine can satisfy the entire query by reading the index alone, without accessing the underlying table (heap) pages. This access patter…
Read full answer →Database replication strategies fundamentally differ in where writes are accepted, which drives everything from consistency guarantees to operational complexity.
Read full answer →**Replication** is the process of copying data from a primary (master) database to one or more replicas (secondaries). It serves two purposes: durability (data survives primary failure) and read scaling (queries can be distributed across replicas).
Read full answer →Query optimization is the discipline of reducing query latency and server load without changing correctness. It spans schema design, index strategy, query rewriting, and infrastructure choices.
Read full answer →`SELECT FOR UPDATE` is a SQL statement that reads rows and immediately acquires an exclusive row-level lock on them within the current transaction. Other transactions attempting to modify those rows — or acquire their own `SELECT FOR UPDATE` locks — will block until your transaction completes. Re…
Read full answer →Checking for date range overlap is a deceptively simple problem that many engineers get wrong by trying to enumerate overlap cases. The correct approach is to use the complement: two ranges do NOT overlap when one ends before the other starts. Negating that gives the universal overlap condition.
Read full answer →Optimistic locking is a concurrency control strategy that avoids holding database locks during reads. Instead of locking a row when you read it, you record its current version, perform your computation, and then verify the version hasn't changed at write time. If another transaction modified the …
Read full answer →A partial index (also called a filtered index in SQL Server) is an index built only over the rows that satisfy a specified WHERE condition. Instead of indexing every row in a table, the index stores only entries for the rows matching the predicate, making it smaller, faster to scan, and cheaper t…
Read full answer →A composite index (also called a multi-column index) is an index built on two or more columns in a defined order. The key principle governing its use is the leftmost prefix rule: the database can use the index only when the query's predicates include the leading columns of the index in order, wit…
Read full answer →Database prep pays off when you can explain internals, not just usage. Pick three topics — indexing (B-trees vs LSM), MVCC vs locking, and replication (sync vs async) — and be able to draw each on a whiteboard from first principles. If you can only recite what an isolation level is called but not what anomaly it prevents, you have a gap that a senior interviewer will find on the second follow-up.
Then practice trade-off framings. “When would you choose eventual consistency” is worth more than naming every isolation level. Interviewers reward candidates who name concrete production scenarios — the specific business flow where phantom reads actually cost money.
Take a free AI-graded assessment across multiple domains. No signup required.
Start Free Assessment