Database Engineer Interview Questions
40+ original questions across SQL, database design, PostgreSQL, MySQL, indexing and performance tuning, replication and backup, NoSQL (MongoDB, Redis, Cassandra, DynamoDB), and the AI-era skills every database engineering interview now touches.
15 Fresher18 Mid-Level11 Senior
Fresher
What's the difference between WHERE and HAVING, and why can't a WHERE clause filter on an aggregated value like COUNT(*)?
WHERE filters individual rows before any grouping or aggregation happens, operating on raw row data as it exists before GROUP BY collapses rows together. HAVING filters groups after aggregation has already happened, which is why it's the clause capable of referencing an aggregate like COUNT(*) or SUM(amount) — those values don't exist yet at the point WHERE is evaluated, since aggregation hasn't occurred. Attempting WHERE COUNT(*) > 5 fails because the database would have to compute the count before it's determined which rows pass the filter, which is logically backwards given the order these clauses are meant to execute in — HAVING COUNT(*) > 5, evaluated after grouping, is the correct place for that condition. Understanding this ordering (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY — the logical processing order, not the order the clauses are written) explains a good share of 'why doesn't this filter work' confusion.What interviewers look for
- correctly explains WHERE filters rows before aggregation, HAVING filters groups after
- correctly explains why an aggregate isn't available yet at the WHERE stage
- shows awareness of SQL's logical clause processing order
What does a transaction's COMMIT and ROLLBACK do, and why would a multi-step update (debit one account, credit another) be wrapped in a single transaction?
A transaction groups a sequence of statements so they succeed or fail together as one unit —
COMMIT makes every change within it permanent and visible to other queries, while ROLLBACK undoes everything done since the transaction began, as if none of it had happened. Wrapping a debit-and-credit transfer in a single transaction matters because, without it, a failure partway through (a crash, a constraint violation, a network interruption) after the debit step but before the credit step would leave money deducted from one account with nothing added to the other — a real, visible inconsistency that's hard to detect and harder to fix after the fact. With both steps inside one transaction, either both complete and commit together, or an error anywhere in the sequence triggers a rollback that undoes the debit too, so the two accounts are never left in that broken, half-finished intermediate state at any point other party could observe.What interviewers look for
- correctly explains COMMIT's permanence and ROLLBACK's full undo
- correctly explains the specific failure mode a transaction prevents (partial, inconsistent state)
- explains why the alternative (no transaction) risks real data inconsistency
What does normalization to Third Normal Form (3NF) require, and what real problem does an un-normalized table with repeated data cause?
3NF requires a table to already satisfy Second Normal Form (every attribute that isn't part of the key depends on the entire key, never just a piece of it) and additionally have no transitive dependency — a column's value shouldn't be determined by some other column that itself isn't the key, only by the key directly. A concrete un-normalized example: an orders table storing a customer's full address directly on every order row, repeated identically for every order that same customer places. The real problem this causes is an update anomaly — if that customer's address changes, every single order row needs to be updated to stay consistent, and missing even one creates a genuine contradiction (two rows for the same customer disagreeing about their address), with nothing in the un-normalized structure itself preventing that drift. Normalizing moves the address into its own customers table referenced by a foreign key, so it exists in exactly one place and an update only ever needs to happen once, structurally eliminating that entire class of inconsistency.
What interviewers look for
- correctly explains the transitive-dependency rule 3NF adds beyond 2NF
- gives a correct, concrete example of repeated data causing an update anomaly
- explains how normalizing structurally eliminates that specific inconsistency risk
What's the difference between a one-to-many and a many-to-many relationship, and how is a many-to-many relationship implemented in a relational schema?
A one-to-many relationship means one row in a table can relate to many rows in another, but each of those related rows relates back to only one row in the first table — one customer can have many orders, but each order belongs to exactly one customer. A many-to-many relationship means rows on both sides can relate to multiple rows on the other side — a student can enroll in many courses, and a course can have many students — and relational databases can't represent this directly with a simple foreign key on either table, since a single foreign key column can only point to one row. The standard implementation is a junction (or association) table sitting between the two — a table whose rows each hold a pair of foreign keys, one referencing each side, with one row per relationship — turning the many-to-many relationship into two one-to-many relationships, one from each original table into the junction table, which relational databases handle natively.
What interviewers look for
- correctly distinguishes one-to-many from many-to-many with correct examples
- correctly explains why a simple foreign key can't represent many-to-many directly
- correctly describes the junction/association table pattern
What's the difference between PostgreSQL's VARCHAR, VARCHAR(n), and TEXT types, and is there a real performance reason to prefer one?
TEXT and unbounded VARCHAR (without a length limit) are functionally identical in PostgreSQL internally — both store variable-length text with no enforced maximum, and PostgreSQL doesn't pad or waste space based on which one is declared. VARCHAR(n) adds an enforced maximum length constraint, rejecting an insert that exceeds n characters, which is a data-validation choice rather than a storage or performance one — PostgreSQL stores the two no differently once the length constraint itself isn't violated. This differs from some other database systems where VARCHAR and TEXT have different storage mechanics and real performance implications, which is a common source of unnecessary caution carried over from experience with a different database — in PostgreSQL, the choice between TEXT and unbounded VARCHAR is purely stylistic, and only VARCHAR(n)'s length constraint is a real behavioral difference worth deciding on deliberately.What interviewers look for
- correctly states TEXT and unbounded VARCHAR are functionally identical in PostgreSQL
- correctly identifies VARCHAR(n)'s length constraint as the real behavioral difference
- corrects the common misconception carried over from other databases
What does PostgreSQL's SERIAL type do under the hood, and why is GENERATED ALWAYS AS IDENTITY generally recommended over it for a new table today?
SERIAL is shorthand that creates an integer column, attaches a separate sequence object to generate the next value, and sets that sequence as the column's default — it works, but the sequence is a distinct database object with its own permissions, and an insert explicitly specifying a value for that column can bypass the sequence entirely, silently leaving the sequence out of step with the table's real data if a value far ahead of the sequence's current position is inserted manually. GENERATED ALWAYS AS IDENTITY is a standard SQL-compliant approach that more tightly binds the generation logic to the column itself, and in its default ALWAYS form, actively rejects an explicit insert into that column rather than silently allowing a value that could desynchronize the counter, catching that class of mistake immediately instead of letting it cause a confusing problem discovered much later. Recommended practice has shifted toward GENERATED ALWAYS AS IDENTITY for this tighter coupling and earlier error detection, with SERIAL remaining mostly for compatibility with older code written before the identity syntax existed.What interviewers look for
- correctly explains SERIAL's underlying sequence-object mechanism
- correctly explains the desync risk from bypassing the sequence with an explicit insert
- correctly explains why GENERATED ALWAYS AS IDENTITY catches this earlier
What's the difference between MySQL's InnoDB and MyISAM storage engines, and why is InnoDB the default for nearly all modern use cases?
InnoDB supports transactions (commit/rollback, ACID guarantees) and row-level locking, letting multiple transactions modify different rows of the same table concurrently with minimal contention, and it enforces foreign key constraints natively. MyISAM, an older engine, doesn't support transactions at all, uses table-level locking (any write locks the entire table, not just the affected rows, which badly limits concurrency under real write load), and has no foreign key enforcement. InnoDB became the default because the overwhelming majority of real applications need transactional guarantees for data integrity, and table-level locking's concurrency ceiling becomes a real bottleneck under any meaningful simultaneous write load, which MyISAM structurally can't avoid regardless of tuning. MyISAM still exists for specific, narrow legacy or read-mostly use cases where its somewhat lower overhead for pure reads was historically a relevant trade-off, but it's a deliberate, narrow exception rather than a general-purpose alternative today.
What interviewers look for
- correctly explains InnoDB's transaction support and row-level locking
- correctly explains MyISAM's table-level locking limitation
- explains why InnoDB became the sensible general default
What is a database index, conceptually, and why doesn't it make sense to add an index to every column 'just in case'?
An index is a separate, ordered data structure (commonly a B-tree) built on one or more columns that lets the database locate matching rows directly, without scanning every row in the table, much like a book's index lets a reader jump to a page instead of reading the whole book to find a topic. Adding an index to every column doesn't come free, because every index has to be updated whenever a row is inserted, updated, or deleted — more indexes means more write overhead on every single write operation, and indexes also consume real disk space. A column that's rarely filtered on in queries gains little or no read benefit from being indexed while still paying the full write-overhead and storage cost on every write, which is a bad trade for a write-heavy or rarely-queried column. The right approach is indexing columns that are, frequently used in filters, joins, or sort conditions — not reflexively indexing everything on the theory that indexes can only help.
What interviewers look for
- correctly explains the index as a separate ordered structure enabling direct lookup
- correctly explains the write-overhead and storage cost of every additional index
- concludes indexing should be targeted at queried columns, not applied universally
A query filters on two columns with WHERE status = 'active' AND region = 'west', but only one of them is indexed. What happens, and would a composite index on both columns help?
With only one of the two columns indexed, the database can use that index to narrow down to rows matching that specific condition quickly, but then has to check the second, unindexed condition by examining each of those narrowed-down rows individually rather than jumping directly to matches — faster than scanning the whole table, but not as fast as it could be if both conditions could be resolved through an index directly. A composite index covering both columns, in the right column order, lets the database satisfy both conditions in a single index lookup rather than an index lookup followed by a secondary row-by-row check, which is meaningfully faster when both conditions are commonly filtered together. Column order in a composite index matters: an index on
(status, region) helps a query filtering on status alone or on both status and region together, but doesn't help nearly as much a query filtering on region alone, since the index's usefulness for a prefix-only match depends on which column comes first in its definition.What interviewers look for
- correctly explains the partial benefit of a single-column index when two conditions are filtered
- correctly recommends a composite index and explains why it's faster
- correctly explains column order matters for which queries the composite index helps
What's the difference between a database backup and database replication, and why does having replication alone not substitute for having backups?
A backup is a point-in-time snapshot of the data, stored independently from the live database, that can be restored later to bring data back to that specific captured moment. Replication continuously copies changes from a primary database to one or more replicas in close to real time, mainly for availability (a replica can take over if the primary fails) and read scaling (replicas can serve read traffic), not for preserving historical snapshots. The reason replication alone doesn't substitute for backups is that replication faithfully copies mistakes too — if a bad
DELETE or a corrupting bug runs against the primary, that same destructive change propagates to every replica almost immediately, since replication's entire purpose is keeping replicas consistent with the primary's current state, mistakes included. A backup taken before that mistake happened is the only thing that can restore the prior, correct state; replication has no concept of 'the state before this specific mistake; it only knows 'the current state, kept in sync.'What interviewers look for
- correctly explains backups as point-in-time snapshots versus replication's real-time copying
- correctly explains replication's purpose (availability/read scaling), not historical preservation
- correctly explains why replication propagates mistakes rather than protecting against them
What's the core structural difference between a MongoDB document and a relational database row, and what real flexibility does that give an application dealing with varying data shapes?
A relational row is a fixed set of columns defined by the table's schema — every row in the same table has exactly the same columns, even if many are left null for a given row. A MongoDB document is a flexible, often nested JSON-like structure, and different documents within the same collection can have completely different fields, with no schema enforced at the database level by default. This gives real flexibility for data that naturally varies in shape between records — a product catalog where different product categories have different attributes (a book has an author and page count, a laptop has a processor and screen size) can store each product as a document with only the fields relevant to that specific product, rather than a relational table needing either a huge number of mostly-null columns or several separate related tables to represent the same variation. The trade-off is that without the database enforcing a consistent shape, an application has to take on more responsibility for data consistency itself, since the database won't catch a document missing a field it logically should have had.
What interviewers look for
- correctly explains the fixed-schema-row versus flexible-document structural difference
- gives a concrete, correct example of varying data shapes benefiting from this
- mentions the real trade-off (consistency responsibility shifts to the application)
Why is Redis so much faster for simple lookups than a typical relational database, and what's the real trade-off behind that speed?
Redis keeps its entire dataset in memory (RAM) by default, and reading or writing to memory is dramatically faster than reading from disk, which is where a traditional relational database's data primarily lives (even with caching layers helping, a cold read still frequently touches disk). Redis's simple key-value and basic data-structure operations also avoid the overhead a relational database pays for more general-purpose querying — parsing SQL, planning a query, checking constraints — since Redis's operations are intentionally much simpler and more direct. The real trade-off is durability and capacity: data living primarily in memory means a crash without proper persistence configured can lose data that was never written to disk, and the dataset's total size is bounded by available RAM, which is both more expensive and more limited than disk capacity at the same scale — Redis offers persistence options (snapshotting, an append-only log) to mitigate the durability risk, but neither changes the fundamental memory-capacity ceiling.
What interviewers look for
- correctly explains in-memory storage as the core speed advantage
- correctly explains Redis's simpler operation model as a secondary speed factor
- correctly names the real trade-off (durability risk, memory-bound capacity)
What's the practical meaning of Cassandra being described as 'AP' under the CAP theorem, and what does that mean an application has to accept?
The CAP theorem says a distributed system, during a network partition, has to choose between Consistency (every node sees the same data) and Availability (every node keeps responding even if it can't confirm it has the latest data). Cassandra prioritizes Availability and Partition tolerance (AP) by design: during a partition, nodes keep serving reads and writes rather than refusing to respond until consistency is guaranteed — staying available at the cost of potentially serving or accepting data that's momentarily inconsistent across nodes until the partition heals. An application built on Cassandra has to accept eventual consistency as designed behavior, not an occasional bug: a read right after a write might not reflect it yet on every node, and the application logic needs to be comfortable with that for whatever it's built for. The AP label describes Cassandra's default posture, not a fixed setting, though — consistency is tunable per query, through a level like ONE (a single node acknowledges), QUORUM (a majority of replicas agree), or ALL (every replica agrees). Moving toward QUORUM or ALL buys back some consistency, but trades away some of that same availability: a query requiring ALL fails outright if even one replica is unreachable, where ONE would have succeeded regardless.
What interviewers look for
- correctly explains the CAP trade-off Cassandra makes (availability over strict consistency)
- correctly explains what happens during a partition under this choice
- correctly explains eventual consistency as a real application-level implication to design around
- correctly explains that consistency is tunable per query (ONE/QUORUM/ALL) and that stronger levels trade away some availability
What's the difference between DynamoDB's partition key and sort key, and why does choosing a good partition key matter for how evenly load spreads across the service?
The partition key determines which physical partition a given item is stored on — DynamoDB hashes the partition key's value to decide placement, and items sharing the same partition key value end up grouped together on the same partition. The sort key, when a table has one, orders items within that same partition key group, letting a query efficiently retrieve a range of related items (all orders for one customer, sorted by date, for instance) without needing a separate lookup per item. A good partition key spreads values evenly across many different values, so DynamoDB's automatic partitioning distributes load roughly evenly across its underlying physical partitions; a poorly chosen partition key — one with very few distinct values, or one where a small number of values receive dramatically more traffic than others — concentrates load onto a small number of partitions, creating a hot partition that becomes a real throughput bottleneck regardless of how much total capacity the table is provisioned with overall.
What interviewers look for
- correctly explains the partition key's placement role and sort key's within-partition ordering role
- correctly explains how partition key choice affects load distribution
- correctly explains the hot-partition consequence of a poor choice
An AI assistant generates a database migration script for you from a plain-English description of a schema change. What should you check before running it against production?
A migration script that runs without error and produces the described schema change doesn't automatically mean it's safe for an existing table with real data in it — a generated migration can correctly add a new column while missing that the column should have a default value for existing rows, or add a
NOT NULL constraint that will fail outright the moment it hits existing rows already containing nulls in that column. Reading through the generated migration's statements, checking how it handles existing data (not just the resulting schema shape), and running it first against a realistic copy of production data rather than an empty test database are the concrete checks that catch this category of problem before it causes a real outage. It's also worth checking whether the migration is reversible or has a clear rollback path, since a generated script optimized for 'produce the described end state' doesn't automatically consider what happens if the migration needs to be undone partway through a production deployment.What interviewers look for
- explains that a correct end-state schema doesn't guarantee safety against existing data
- proposes testing against realistic data, not an empty database
- mentions checking for a rollback path, not just the forward migration
Mid-Level
What do the four ACID properties stand for, and which one is most directly responsible for preventing two concurrent transactions from seeing each other's uncommitted changes?
ACID stands for Atomicity (a transaction's steps succeed or fail together as a unit), Consistency (a transaction can only move the database from one valid state to another, never leaving it in a state that violates its own constraints), Isolation (concurrent transactions don't interfere with or see each other's intermediate, uncommitted work), and Durability (once committed, a change survives even a crash immediately afterward). Isolation is the property responsible for preventing one transaction from seeing another's uncommitted changes — without it, a transaction reading data mid-way through a different transaction's unfinished work could see a value that's about to be rolled back, acting on data that technically never became real. The exact strength of isolation is itself tunable via isolation levels (read committed, repeatable read, serializable, among others), each trading some performance for a stronger guarantee against specific categories of concurrency anomaly, so 'isolation' isn't a single fixed guarantee but a spectrum a database can be configured along.
What interviewers look for
- correctly defines all four ACID properties
- correctly identifies Isolation as the property governing concurrent visibility
- shows awareness that isolation level is itself a tunable spectrum, not one fixed guarantee
What's a deadlock in a database, and why can't it simply be prevented by always acquiring locks in the exact same order across every transaction?
A deadlock happens when two (or more) transactions each hold a lock the other needs, and each is waiting for the other to release its lock first — neither can proceed, and without intervention, both would wait forever. Always acquiring locks in the same order across every transaction really does prevent deadlocks in principle, since a consistent global ordering means one transaction can never be waiting on a lock held by a transaction that's itself waiting on a lock the first one holds. The practical difficulty is that enforcing a single, consistent lock-acquisition order across every transaction in a real application — especially one with many different code paths, written by different people over time, touching overlapping sets of tables in different sequences for different legitimate reasons — is hard to guarantee comprehensively in practice, which is exactly why databases detect and resolve deadlocks automatically (rolling back one of the transactions involved) rather than relying purely on application discipline to prevent every possible deadlock from ever occurring.
What interviewers look for
- correctly explains the mutual-wait condition that defines a deadlock
- correctly explains why consistent lock ordering would theoretically prevent it
- explains why that discipline is hard to guarantee in a real, large application
When would deliberately denormalizing a schema — reintroducing some duplication a normalized design had eliminated — be the right call rather than a mistake?
Normalization optimizes for write consistency and avoiding update anomalies, but it also means reconstructing a complete picture of related data at read time requires joining across multiple tables, and for a workload that's heavily read-dominated with comparatively rare writes, the repeated cost of that join on every single read can become the bottleneck worth addressing. Deliberately denormalizing — storing a frequently-needed derived or joined value directly on the table that reads it most often, accepting the duplication and the discipline needed to keep it in sync — trades a small, controlled increase in write complexity (now two places need updating instead of one) for meaningfully faster reads, which is the right trade when reads vastly outnumber writes and the join cost is measurably hurting performance. This is a deliberate, documented decision made after confirming the join really is the bottleneck, not a default — normalizing first and denormalizing only the specific, measured hot paths that need it keeps the rest of the schema's write-consistency benefits intact.
What interviewers look for
- correctly identifies the read-heavy, join-cost-dominated scenario where denormalization pays off
- explains the real trade (write complexity for read speed), not treating it as free
- frames this as a deliberate, measured decision on specific hot paths, not a default approach
A table uses an auto-incrementing integer as its primary key, but a new requirement needs records to be mergeable from multiple independent systems without id collisions. What would you change, and why does the auto-increment approach break here?
An auto-incrementing integer key is assigned sequentially by a single database instance, so two independent systems each generating their own auto-incrementing ids will almost certainly produce overlapping values — system A's order #1047 and system B's order #1047 are different records that would collide the moment their data needs to merge into one dataset, since the key that's supposed to uniquely identify a row no longer does once two systems' sequences are combined. A UUID (or a similar globally-unique identifier generated independently by each system, with no central coordination needed) solves this directly, since the probability of two independently-generated UUIDs colliding is astronomically small regardless of how many systems are generating them concurrently with no coordination between them at all. The trade-off worth knowing: UUIDs are larger than integers (more storage, slightly larger indexes) and, depending on the UUID version used, can hurt insert performance on an index that expects roughly sequential values, which is why some systems use a UUID variant designed to remain roughly time-ordered, balancing global uniqueness against that indexing cost.
What interviewers look for
- correctly explains why independent auto-increment sequences collide once merged
- correctly proposes UUIDs (or equivalent) as the fix and why they avoid collision
- mentions the real trade-off (size, potential index performance impact) rather than treating UUIDs as free
What is MVCC in PostgreSQL, and why does a long-running transaction holding an old snapshot cause table bloat even if it never writes anything?
MVCC (Multi-Version Concurrency Control) is how PostgreSQL handles concurrent reads and writes without readers blocking writers or vice versa: rather than locking rows for reading, each transaction sees a consistent snapshot of the data as it existed at a specific point, and updates don't overwrite a row in place — they create a new row version, leaving the old version intact until nothing needs it anymore. A long-running transaction, even a purely read-only one, holds a reference to an old snapshot for its entire duration, which means PostgreSQL can't yet reclaim (vacuum) the old row versions that transaction might still need to see, even if those versions have been superseded many times by newer writes from other transactions in the meantime. The practical effect is table bloat: dead row versions pile up because the long-running transaction is effectively pinning them in place, and this keeps happening for as long as that transaction stays open, regardless of how much write activity occurs elsewhere — closing or avoiding unnecessarily long-running transactions is the direct fix, since vacuum can only clean up what no active transaction still needs.
What interviewers look for
- correctly explains MVCC's snapshot-based concurrency and new-row-version-on-update mechanism
- correctly explains why a long-running read-only transaction still prevents cleanup
- connects this directly to vacuum and table bloat
What does PostgreSQL's EXPLAIN ANALYZE show that plain EXPLAIN doesn't, and why would you want to be cautious running EXPLAIN ANALYZE on a write-heavy query in production?
Plain
EXPLAIN shows the query planner's estimated execution plan — which join strategy, which index (if any), and estimated row counts — based purely on statistics, without running the query at all. EXPLAIN ANALYZE executes the query for real and shows the real timing and row counts alongside the plan, letting you compare the planner's estimates against what happened, which is essential for spotting cases where the planner's statistics are stale or wrong, leading it to choose a poor plan based on an inaccurate guess. The caution with a write query (an UPDATE, DELETE, or INSERT wrapped in a query being analyzed) is that EXPLAIN ANALYZE executes it for real too — it isn't a dry run or simulation — so running it on a write query in production performs that write, which is rarely the intent when someone just wants to understand a plan. Wrapping it in a transaction that's rolled back afterward, or testing against a non-production replica, avoids committing an unintended write while still getting the real execution statistics needed.What interviewers look for
- correctly explains EXPLAIN's estimate-only nature versus ANALYZE's real execution
- correctly explains the real risk: ANALYZE runs the query, including writes
- proposes a concrete safeguard (transaction rollback, non-production testing)
A MySQL table's primary key is a UUID stored as a string, and insert performance has degraded noticeably as the table grew. How does InnoDB's clustered index design explain this?
InnoDB physically stores table rows ordered by the primary key — the primary key isn't just a logical uniqueness constraint, it's the physical ordering of data on disk, called a clustered index. A sequential, ever-increasing key (like an auto-incrementing integer) means new rows are always inserted at the physical end of that ordering, which is cheap and predictable. A UUID, especially a standard random one, has no inherent ordering relative to previously inserted values, so each new insert lands at an essentially random position within the existing physical order, forcing frequent page splits and reorganization to maintain that order as the table grows — a meaningfully more expensive operation than appending sequentially, and one that gets worse as the table gets larger and the random insertion points spread the reorganization work across more of the existing data. Switching to a sequential surrogate key for the clustered index, while keeping a UUID as a separate, non-clustered unique column if global uniqueness across systems is still needed, resolves this specific insert-performance degradation while preserving the UUID's benefit where it matters.
What interviewers look for
- correctly explains InnoDB's clustered index physically orders rows by primary key
- correctly explains why a random UUID forces expensive page reorganization on insert
- proposes the sequential-key-plus-separate-UUID-column fix
A query uses WHERE last_name LIKE '%smith%' and runs slowly despite an index existing on last_name. Why doesn't the index help here?
A standard B-tree index is organized for efficient prefix matching — it can quickly jump to all values starting with a given prefix, which is exactly what a query like
LIKE 'smith%' (a leading wildcard-free pattern) can exploit. A leading wildcard, as in '%smith%', means the match could start anywhere within the string, not at a known prefix, and a B-tree index's ordering simply doesn't help locate 'contains this substring anywhere' efficiently, since that isn't a question about where a value sits in sorted order at all — the database typically falls back to scanning every row and checking the pattern against each one individually, regardless of the index's existence. A full-text search index, or a trigram-based index (available as an extension in some databases), is built to support this kind of substring search efficiently, and switching to one of those, rather than relying on a standard B-tree index, is the real fix for a workload that needs this pattern of search rather than true prefix matching.What interviewers look for
- correctly explains B-tree indexes support prefix matching, not arbitrary substring matching
- correctly explains why a leading wildcard defeats that mechanism entirely
- proposes full-text or trigram indexing as the real fix, not just 'the index should help'
What's the difference between a covering index and a regular index, and why can a covering index avoid a round trip to the real table data entirely?
A regular index typically stores only the indexed column(s) plus a pointer back to the full row, so once the database finds a matching entry in the index, it still has to follow that pointer and fetch the row from the table to retrieve any other columns the query needs — an extra lookup per matching row. A covering index includes every column a specific query needs directly within the index itself, so the database can answer the entire query from the index alone, with no need to follow a pointer back to the table at all, since nothing additional is required beyond what's already sitting in the index. This meaningfully speeds up read-heavy queries that repeatedly ask for the same small set of columns, in exchange for a bulkier index that now holds more than just the filtered or sorted column — a deliberate, targeted trade worth making for a query pattern frequent and performance-sensitive enough to justify the extra size, not applied blanket across every query.
What interviewers look for
- correctly explains the extra table lookup a regular index requires
- correctly explains how a covering index eliminates that lookup
- mentions the real trade-off (larger index size) and frames it as a targeted decision
What's the difference between synchronous and asynchronous replication, and what specific trade-off does an organization accept by choosing asynchronous for better write performance?
Synchronous replication requires the primary to wait for confirmation that a replica has received and persisted a write before considering that write committed, guaranteeing a replica is always fully up to date with the primary at the cost of added write latency, since every write now waits on that round trip to the replica. Asynchronous replication lets the primary commit a write immediately and propagate it to replicas afterward, without waiting, which gives faster write performance but creates a real window where a replica can be behind the primary — if the primary fails during that window, whatever writes hadn't yet replicated are lost, not just delayed, since there's no record of them anywhere except the now-failed primary. The trade-off an organization accepts by choosing asynchronous replication for better write performance is exactly that possibility of recent data loss during a primary failure, which is a real, understood cost worth explicitly accepting (or mitigating with a semi-synchronous hybrid, waiting for at least one replica to confirm) rather than discovering only after a failure reveals it.
What interviewers look for
- correctly explains the wait-for-confirmation mechanism distinguishing sync from async
- correctly explains the real risk: potential data loss during a primary failure under async
- mentions semi-synchronous as a real middle-ground option
An organization takes nightly full backups but has never tested restoring one. What's the real risk in that, and what would a reasonable backup validation practice look like?
A backup that's never been restored is, strictly speaking, an unverified assumption, not a confirmed safety net — backups can silently fail in ways that only surface at restore time: a corrupted file nobody noticed, a backup process that's been quietly failing for weeks while still reporting success, a restore procedure that depends on a tool version or configuration that's since changed and no longer works as expected. Discovering any of these during a real disaster, when the backup is urgently needed and there's no time to debug a broken restore process calmly, turns a routine recovery into a much worse crisis than the original incident that made the restore necessary in the first place. A reasonable practice is restoring a backup to a separate, isolated environment on a regular schedule — not just checking that the backup job reports success, but confirming the restored data is complete and correct — which is the only way to know the backup and restore process works end to end, rather than trusting an untested assumption until the one moment it matters most.
What interviewers look for
- correctly identifies an untested backup as an unverified assumption, not a real safety net
- names concrete real failure modes a backup can have that a restore test would catch
- proposes a regular, real restore-and-verify practice, not just checking job success logs
In MongoDB's document model, when would you embed related data directly inside a document versus referencing it in a separate collection, the way a relational foreign key would?
Embedding works well when the related data is always accessed together with its parent and doesn't need to be queried or updated independently — a blog post embedding its own comments directly, for instance, if comments are only ever read in the context of that specific post and rarely updated independently of it, means one single read retrieves everything needed with no separate lookup. Referencing (storing an id and looking the related data up in a separate collection, closer to a relational foreign key) fits better when the related data is shared across many parent documents, needs to be queried or updated independently of any one specific parent, or would make the parent document grow unboundedly large over time — embedding an unbounded, ever-growing list of comments directly inside a post document eventually runs into MongoDB's per-document size limit and makes the parent document progressively more expensive to read and write as it grows. The practical rule: embed for data that's bounded in size and consistently accessed together; reference for data that's shared, independently queried, or could grow without a natural limit.
What interviewers look for
- correctly explains when embedding is the right fit (bounded, always-together access)
- correctly explains when referencing is the right fit (shared, independently queried, or unbounded growth)
- mentions the document size limit as a real, concrete constraint driving this decision
A MongoDB aggregation pipeline runs noticeably slower after a $match stage was moved to later in the pipeline instead of first. Why does stage order matter here?
An aggregation pipeline processes documents through its stages in the exact order they're defined, and each stage operates on whatever set of documents the previous stage passed along to it — a
$match placed early filters down to only the relevant documents immediately, so every subsequent stage (sorting, grouping, projecting) operates on that much smaller, already-filtered set. Moving the same $match later means every stage before it has to process the full, unfiltered document set first, doing real work — sorting, grouping, transforming — on documents that $match would have excluded anyway, work that turns out to be entirely wasted once those documents are filtered out downstream regardless. Filtering as early as possible in a pipeline, the same general principle as filtering early in a SQL query, reduces the amount of data every subsequent stage has to process, which is exactly why reordering a late $match to the front of the pipeline typically restores the lost performance without changing the pipeline's output at all.What interviewers look for
- correctly explains pipeline stages process documents in the order they're defined
- correctly explains the wasted-work consequence of filtering late
- connects this to the general early-filtering principle shared with SQL
A cache-aside pattern using Redis occasionally serves stale data right after a database update. What's the likely cause, and how would you fix it?
In a cache-aside pattern, the application is responsible for both reading from the cache (falling back to the database and populating the cache on a miss) and invalidating or updating the cache whenever the underlying database changes — if the application updates the database but forgets, fails, or races on invalidating the corresponding cache entry, the cache keeps serving the old value until it separately expires, which is exactly the stale-data symptom described. A common race: if the invalidation step runs before the database write fully commits, a concurrent read in that narrow window could repopulate the cache with the still-old value right after invalidation, undoing the fix. The more robust pattern invalidates (or updates) the cache only after the database write has fully and successfully committed, and for cases where even a brief staleness window is unacceptable, write-through caching (updating the cache as part of the same write operation, rather than invalidating and relying on a later read to repopulate it) removes that gap entirely at the cost of a slightly more complex write path.
What interviewers look for
- correctly explains cache-aside's invalidation responsibility sitting with the application
- identifies a concrete race condition between invalidation timing and the database commit
- proposes a concrete fix (invalidate-after-commit, or write-through as a stronger alternative)
Why does Cassandra require queries to be designed around the data's access patterns up front, in a way that differs meaningfully from a relational database's 'model the data, query it however you need later' approach?
A relational database can answer a wide range of ad hoc queries against a normalized schema reasonably well because joins let it reconstruct whatever shape of data a query happens to need, computed at query time. Cassandra is a distributed, partition-based system where data for a given partition key lives together on specific nodes, and it deliberately doesn't support arbitrary joins across tables at query time — attempting to query by anything other than the partition key (or a defined secondary pattern) a table was designed around requires scanning across many partitions and nodes, which doesn't scale the way Cassandra is meant to. This means a Cassandra schema is designed backwards from the relational approach: starting from the specific queries the application needs to run, and shaping tables (often duplicating the same data into multiple differently-keyed tables, one per access pattern) around exactly those queries, rather than normalizing the data once and trusting joins to answer whatever comes up later. Getting this wrong — building a Cassandra schema the relational way and discovering query needs only after the fact — is a common, expensive design mistake that often requires a real schema rework once it surfaces.
What interviewers look for
- correctly explains Cassandra's lack of general joins and why that matters at its scale
- correctly explains the query-first schema design approach this requires
- frames designing schema the relational way as a real, common, costly mistake in Cassandra
An application needs to query a DynamoDB table by an attribute that isn't the partition key or sort key. What are the real options, and what does each cost?
A
Scan operation reads every item in the table and filters afterward, which technically works for querying by any attribute but reads (and pays for, under provisioned or on-demand billing) the entire table's data regardless of how few items match — a cost that scales with total table size, not with how selective the filter is, making it a poor fit for anything beyond a small table or a rare, non-performance-sensitive operation. A Global Secondary Index (GSI) creates an additional, separately-maintained index structured around a different partition/sort key combination, letting that attribute be queried efficiently the same way the primary key can be — at the cost of additional storage for the duplicated index data and additional write cost to keep the GSI in sync with every write to the base table. The real decision is whether this access pattern is frequent and performance-sensitive enough to justify a GSI's ongoing storage and write cost, versus being rare enough that an occasional, accepted-as-expensive Scan is tolerable — not treating Scan as a free general-purpose query mechanism for a pattern that's used often.What interviewers look for
- correctly explains Scan's full-table-read cost regardless of selectivity
- correctly explains a GSI's mechanism and its real ongoing cost (storage, write overhead)
- frames the decision around frequency/performance sensitivity of the access pattern
A teammate uses an AI assistant to generate an index recommendation for a slow query, and it suggests a composite index across five columns. How would you evaluate whether this is a good recommendation?
A wide composite index can speed up the one specific query it was generated for, but an AI assistant optimizing narrowly for that single query's performance has no visibility into the index's cost on every write to that table going forward, nor whether a narrower, already-existing index might cover most of the same benefit with less ongoing overhead — recommendations generated in isolation, one query at a time, can accumulate into a table with many overlapping, redundant, overly wide indexes if each one is accepted without checking against what's already there. Evaluating this properly means checking whether a narrower index (fewer columns, or reordering columns to overlap better with an existing index's prefix) would achieve most of the same speedup, estimating the write-overhead cost of a five-column index on this table's real write volume, and confirming the suggested column order matches how the query filters and sorts, since composite index column order correctness isn't something a plausible-looking recommendation guarantees was reasoned through correctly. Treating the suggestion as a reasonable starting hypothesis to verify against the table's full query and write workload, not as a validated final answer, is what prevents index sprawl over time.
What interviewers look for
- correctly explains the risk of narrowly-optimized, per-query index recommendations accumulating
- proposes checking for a narrower or overlapping existing index instead
- proposes verifying write-overhead cost and column order against the real workload, not accepting it as-is
You ask an AI tool to explain why a specific query is slow, and it confidently points to a particular cause. What's a real risk in trusting that explanation without independently verifying it?
A confident, well-written explanation of why a query is slow can sound entirely plausible while really describing the wrong cause, since a tool without direct access to this specific database's real execution plan, statistics, and data distribution is reasoning from general patterns about what commonly causes slow queries, not from this query's real, verified behavior in this specific environment. Acting on a plausible-but-wrong diagnosis — adding an index the explanation suggested, restructuring a join it blamed — wastes real effort and can introduce new costs (an unnecessary index's write overhead, for instance) without fixing the real underlying problem, which remains unaddressed and will keep causing the same slowness. The reliable check is running the query's real execution plan directly against the real database and confirming that what it shows (which operation is expensive, which index is or isn't being used) matches the suggested explanation before acting on it — treating the AI's explanation as a hypothesis to verify against the database's own real diagnostic output, not as a confirmed diagnosis just because it reads convincingly.
What interviewers look for
- explains why a confident explanation can still be wrong without real execution-plan access
- explains the real cost of acting on a plausible-but-wrong diagnosis
- proposes verifying against the real execution plan before acting on the suggested cause
Senior
An application running under the 'read committed' isolation level reports a bug where a report run twice within the same transaction returns different totals each time, with no writes happening from that same transaction in between. How would you explain this, and what isolation level would fix it?
This is a non-repeatable read, a known anomaly permitted under read committed isolation: that level only guarantees a transaction never sees another transaction's uncommitted changes, but it says nothing about preventing a different transaction from committing new changes in between two reads within the first transaction — if another transaction commits an update to the relevant rows between the report's first and second read, the second read correctly sees that newly committed data, producing a different total even though the reporting transaction itself never wrote anything. Moving to 'repeatable read' isolation fixes exactly this: once a transaction reads a row, that transaction is guaranteed to see the same value for that row on any subsequent read within the same transaction, regardless of what other transactions commit in the meantime. It's worth noting repeatable read still permits a different anomaly (phantom reads, where a second identical query returns additional rows that didn't exist on the first read) in some database implementations, which is what the strictest level, serializable, additionally closes off.
What interviewers look for
- correctly identifies this as a non-repeatable read, not a bug in the application
- correctly explains read committed permits this specific anomaly
- correctly recommends repeatable read and notes what it still doesn't fully solve (phantom reads)
A startup's schema, designed for a single-tenant product, now needs to support multiple tenants on shared infrastructure as the product moves upmarket. What are the main architectural options, and what drives the choice between them?
Three common patterns exist, trading isolation against operational complexity differently. Separate databases per tenant gives the strongest isolation — one tenant's data is physically separate from another's, simplest to reason about for compliance and blast-radius concerns — at the cost of real operational overhead managing potentially hundreds or thousands of separate database instances, schema migrations needing to run against every single one, and less efficient resource sharing. A shared database with separate schemas per tenant is a middle ground, somewhat easier to operate than fully separate databases while still giving meaningful isolation, though migrations still need to run per schema. A single shared schema with a
tenant_id column on every table scales operationally the best (one schema, one migration path, efficient resource sharing) but requires rigorous enforcement — row-level security or application-layer discipline ensuring every single query is correctly scoped by tenant, since a missing tenant_id filter anywhere is a real cross-tenant data leak, not a cosmetic bug. The right choice depends heavily on compliance requirements (some industries or customers may contractually require physical isolation), expected tenant count and growth, and how confidently the team can guarantee query-level tenant scoping is enforced everywhere without exception.What interviewers look for
- correctly describes at least two of the three patterns with accurate trade-offs
- correctly identifies the real risk of the shared-schema approach (cross-tenant leak from a missing filter)
- grounds the choice in concrete drivers (compliance, scale, enforcement confidence), not a universal answer
A PostgreSQL primary database fails over to a replica, and the application briefly writes to what turns out to be stale data before the failover is fully recognized. What would you check in the failover design to prevent this?
This points at a split-brain risk during failover — a window where the application, DNS, or connection pooling hasn't yet fully recognized the new primary and either keeps writing to the old (now demoted or unreachable) primary, or starts writing to the new primary before replication has fully caught up and confirmed consistency, producing writes against data that doesn't yet reflect the true current state. The failover design needs a clear, enforced mechanism preventing the old primary from accepting writes the moment failover begins — commonly through fencing (actively ensuring the old primary can't accept writes anymore, not just hoping clients stop sending them) — combined with the new primary only being promoted and advertised as ready for writes once it's confirmed caught up with the last known-committed state from the old primary. Checking whether the failover tooling in use (Patroni, a cloud-managed failover mechanism, or a custom script) enforces this fencing guarantee, rather than just updating a DNS record or connection string and assuming clients will converge cleanly without a brief inconsistent window, is the concrete thing to verify before trusting the design under real failure conditions.
What interviewers look for
- correctly identifies this as a split-brain/fencing problem, not a generic 'replication lag' issue
- correctly explains fencing as actively preventing the old primary from accepting writes
- proposes concretely verifying the failover tooling enforces this, not assuming it
A MySQL replication setup using statement-based replication occasionally produces a replica with data that doesn't quite match the primary. What's the likely cause, and how does row-based replication address it?
Statement-based replication works by replaying the literal SQL statements executed on the primary against the replica, which works correctly only if every statement is guaranteed to produce an identical result when re-executed — a non-deterministic statement (one using
NOW(), RAND(), or depending on execution order in a way that isn't guaranteed identical, like certain multi-row updates) can produce a subtly different result when replayed on the replica at a different moment or in a different internal execution order than it did on the primary, which is exactly the kind of drift that produces mismatched data with no error ever being thrown. Row-based replication sidesteps this entirely by replicating the resulting row changes themselves — not the statement that produced them — so the replica applies the exact same row-level changes the primary made, regardless of whether the original statement that generated them was deterministic or not. This is why row-based (or the commonly used mixed mode, which falls back to row-based for statements that are known to be unsafe for statement-based replication) is generally the safer default for correctness, trading a typically larger binary log size for guaranteed replica consistency.What interviewers look for
- correctly identifies non-deterministic statements as the root cause of the drift
- correctly explains row-based replication's fix: replicating results, not statements
- mentions mixed mode as the common practical default, with its trade-off
A production table has accumulated a dozen indexes over time, many added to fix one specific slow query each, and overall write throughput has degraded noticeably. How would you approach cleaning this up without breaking any query that still really depends on one of them?
The safe first step is measuring index usage rather than guessing — most databases expose statistics on how often each index is really used by the query planner, and an index that's rarely or never used in practice is a pure cost (write overhead, storage) with no offsetting read benefit, making it a safe, low-risk candidate for removal. For indexes that are used but might be redundant, checking for overlap matters: a composite index on
(a, b, c) already serves most queries that a standalone index on just a would also serve, since the composite index's prefix behaves like an index on a alone for that purpose, making the standalone, narrower index frequently removable without losing coverage. Removing indexes incrementally, one at a time, with monitoring in place to confirm no previously-fast query suddenly degrades, rather than removing several at once, keeps the process safely reversible if a genuine dependency was missed in the usage-statistics review. This turns 'a dozen indexes accumulated reactively over time' into a deliberately maintained, periodically-reviewed set, rather than treating index cleanup as a one-time cleanup never revisited again.What interviewers look for
- proposes measuring real index usage statistics before removing anything
- correctly explains composite-index prefix overlap as a source of real redundancy
- proposes incremental, monitored removal rather than a risky bulk cleanup
An organization needs a recovery point objective (RPO) of near-zero data loss and a recovery time objective (RTO) of a few minutes for a critical database. What architecture would meet both, and what does each requirement separately demand?
RPO (how much data loss is acceptable, measured in time) and RTO (how quickly service needs to be restored) are separate requirements that different parts of an architecture address. Near-zero RPO demands synchronous or semi-synchronous replication to at least one up-to-date replica, since asynchronous replication's inherent replication lag directly violates a near-zero data loss requirement the moment the primary fails during that lag window — there's no way around this; RPO is fundamentally a replication-strategy question. A few-minutes RTO demands automated failover — detecting the primary's failure and promoting a ready replica to primary without manual intervention, since a human being paged and manually executing a failover runbook, however well-documented, realistically takes longer than a few minutes once response time, diagnosis, and execution are all accounted for; RTO is fundamentally an automation and failover-tooling question. Meeting both simultaneously requires getting both pieces right together — synchronous or semi-synchronous replication alone doesn't achieve fast RTO without automated failover on top of it, and automated failover alone doesn't achieve near-zero RPO without sufficiently tight replication underneath it; each requirement needs its own correctly-designed piece, not one architectural choice solving both.
What interviewers look for
- correctly distinguishes RPO (data loss) from RTO (downtime) as separate requirements
- correctly maps RPO to replication strategy and RTO to automated failover
- explains why both pieces are needed together, not just one architectural choice
A sharded MongoDB cluster has one shard receiving disproportionately more traffic than the others, even though the shard key seems reasonable on paper. How would you diagnose and fix this?
An uneven shard key — even one that looks reasonable in the abstract — can still produce a 'hot' shard if the distribution of real values isn't as even as it appears, or if the key correlates with something that concentrates traffic, like a monotonically increasing field (a timestamp or auto-incrementing id) that always routes new writes toward the same shard range, since all the newest, most-frequently-accessed data keeps landing on one shard. Checking the real distribution of shard key values against genuine production data, not just reasoning about the key's theoretical spread, usually reveals whether this is happening — a shard key that looked evenly distributed on a smaller sample can concentrate badly at real production scale and real usage patterns. The fix often involves choosing a shard key with better real-world cardinality and distribution (sometimes a compound key combining a naturally distributing field with the original key), or, if a monotonic key is the root cause, hashing the shard key to deliberately randomize which shard a given value lands on, trading away range-query efficiency on that field for an even write distribution across all shards.
What interviewers look for
- correctly identifies monotonic keys or poor real-world cardinality as common causes of a hot shard
- proposes checking production value distribution, not just reasoning abstractly
- proposes concrete fixes (better compound key, or hashed sharding) with their real trade-offs
A Redis instance used purely as a cache occasionally evicts keys under memory pressure, and a team member is concerned this represents data loss. How would you frame this correctly, and when would it really be a legitimate concern?
For a Redis instance used purely as a cache — where the real, authoritative data lives in a database and Redis only holds a disposable, regenerable copy for speed — eviction under memory pressure is expected, correct behavior, not data loss: a cache's entire purpose assumes any entry can be safely discarded and regenerated from the real source on the next read, and configuring an eviction policy (commonly least-recently-used) is exactly how Redis is meant to behave when it runs low on memory in that role. This stops being a non-issue, and becomes a legitimate concern, the moment Redis is also being used — intentionally or accidentally — to hold data with no other authoritative source, like a session store with no database backup, a rate-limiting counter whose loss resets limits unexpectedly, or a queue where an evicted entry represents lost work with nothing else capable of regenerating it. The real fix for that legitimate case isn't disabling eviction (which just risks running out of memory entirely instead) — it's recognizing that data has graduated from cache to a role requiring real durability, and either persisting it properly or moving it to a database-backed store designed for that responsibility.
What interviewers look for
- correctly explains eviction is expected, correct cache behavior, not inherent data loss
- correctly identifies when eviction becomes a real concern — no other authoritative source
- proposes the right fix for that case: recognizing a durability requirement has grown in, not disabling eviction
A Cassandra cluster shows one partition growing significantly larger than others, and read latency has degraded just for that partition. How would you diagnose and redesign around this?
A disproportionately large partition — sometimes called a hot or wide partition — usually traces back to a partition key that doesn't naturally bound how much data accumulates under one key value over time: a partition keyed purely by a customer id, for instance, grows without any natural limit for a long-lived, highly active customer, eventually becoming large enough that reads against it (which have to work with that entire partition, at least conceptually, even if only retrieving a slice of it) become measurably slower than reads against normally-sized partitions. Diagnosing this means checking the real distribution of partition sizes in production, not assuming the key's theoretical design is fine — a partition size histogram across the cluster usually reveals the specific outlier key patterns responsible. The fix is typically adding a natural bound to the partition key — bucketing by time period (customer id plus month, for instance) so each bucket's partition size stays naturally capped regardless of how long a customer has been active, trading a bit of query complexity (now potentially needing to query across a few time buckets for a wide date range) for keeping every individual partition's size within a healthy, predictable range.
What interviewers look for
- correctly identifies an unbounded partition key as the likely root cause
- proposes checking real partition size distribution in production as the diagnostic step
- proposes time-bucketing or an equivalent bounding strategy as the concrete fix
A DynamoDB table serving a high-read-volume application is being redesigned to reduce both latency and read cost. How would DAX (DynamoDB Accelerator) help here, and what consistency trade-off does introducing it require accepting?
DAX sits in front of DynamoDB as a managed, in-memory caching layer built for DynamoDB's API, absorbing a large share of read traffic directly from cache rather than hitting DynamoDB itself for every single read — for a read-heavy workload with a meaningful share of repeated reads for the same items, this both reduces latency (an in-memory cache responds faster than DynamoDB's own storage layer) and reduces read cost, since cached reads don't consume DynamoDB read capacity the way a direct read does. The consistency trade-off is real: DAX serves reads from its cache, which can be briefly stale relative to the most recent write until the cached entry's TTL expires or is explicitly invalidated, meaning an application reading through DAX immediately after a write might not see that write reflected yet, even though a direct, uncached read against DynamoDB itself would. This is an acceptable trade for workloads that can tolerate brief staleness in exchange for better latency and cost — read-heavy content serving, for instance — but it's the wrong fit for anything requiring strongly consistent reads immediately after every write, where DAX's caching behavior would introduce a real, unacceptable correctness gap for that specific use case.
What interviewers look for
- correctly explains DAX's caching mechanism and its latency/cost benefit
- correctly explains the real staleness trade-off DAX introduces
- correctly identifies when this trade-off is acceptable versus when it isn't
Your organization is considering an AI tool that automatically applies suggested index changes and query rewrites directly to production based on observed query patterns, with no human approval step. What would concern you about this, and what would you want in place before it's trusted?
Automatically applying schema or indexing changes based purely on observed patterns removes the step where a human with broader context — knowledge of planned future query patterns, upcoming features, or a reason a currently-rarely-used index is deliberately kept for an infrequent but critical report — would catch a change that looks locally reasonable from recent traffic but is wrong for reasons the tool's narrow observation window can't see. The concrete risk is concentrated around irreversible or expensive-to-reverse actions: dropping an index the tool judges unused based on a limited observation window, only for a monthly or quarterly batch job to need it the following week, is a realistic failure mode that pure usage-pattern analysis over a short window wouldn't catch. Before trusting this, requiring every suggested change to go through the same review process as a human-proposed schema change — proposed, reviewed with context the tool doesn't have, and applied deliberately rather than automatically — and insisting any index removal have a long enough observation window to rule out infrequent-but-real usage patterns, closes the gap between what the tool can see and what a human with full organizational context knows.
What interviewers look for
- correctly identifies the lost human-context problem, not just 'automation is risky' in the abstract
- gives a concrete, realistic failure mode (dropping an index needed by an infrequent job)
- proposes human review plus a long-enough observation window before trusting automated changes

