Indexing Strategy and Design Questions
Choosing and designing indexes: B-tree, hash, composite, covering, partial, and full-text/inverted indexes, and the trade-offs between read acceleration and write/storage overhead. Covers selecting index columns from query patterns, cardinality and selectivity reasoning, diagnosing why an index is or is not used, and index maintenance: rebuilding or reorganizing a fragmented index, finding and dropping redundant or unused indexes, and rolling out a new index to production safely. Also covers indexing in analytical (bitmap, columnar), partitioned, and distributed/NoSQL systems. Central to database performance interviews.
As a data engineer you observe that bulk inserts to table logs slowed significantly after adding several indexes. Describe immediate steps you would take to diagnose and mitigate insert slowdown without losing required indexes permanently.
Sample Answer
Direct answer
Don't assume the indexes are the cause; confirm it first with EXPLAIN (ANALYZE, BUFFERS) on the actual insert statement and a look at pg_stat_user_tables/pg_stat_user_indexes, since checkpoint I/O and disk contention produce a very similar symptom and need a completely different fix. If indexes really are the driver, mitigate immediately without permanently losing any of them: batch inserts into fewer, larger transactions (or COPY), drop any index that turns out to be genuinely unused for good, and reserve a scripted, bounded drop-then-rebuild only for indexes you still need but can tolerate briefly missing during a specific catch-up window.
Immediate diagnostic steps
- Rule out the other usual suspect first. A burst of
checkpoint-driven I/O (Postgres periodically flushing all dirty pages to disk) produces the same symptom, bulk inserts suddenly slow, but the fix is tuningcheckpoint_completion_targetandmax_wal_size, not touching indexes at all. Check the Postgres log for checkpoint warnings andpg_stat_bgwriterbefore blaming indexes. - Count and characterize the indexes on
logs.pg_stat_user_indexesgivesidx_scanper index; any index with a near-zero scan count over a representative window is pure write cost with no read benefit today, a candidate for permanent removal, not just a symptom to work around. - Measure the insert cost directly.
EXPLAIN (ANALYZE, BUFFERS)works onINSERTstatements, not justSELECT, and shows real buffer activity for that specific insert. - Confirm the slowdown correlates with when the indexes were added, using
pg_stat_user_tablesgrowth history or deployment timestamps, before committing to an index-focused fix.
Worked example
CREATE TABLE writeamp_1idx (id bigint PRIMARY KEY, a int, b int, c int, d int, e int);
CREATE TABLE writeamp_5idx (id bigint PRIMARY KEY, a int, b int, c int, d int, e int);
CREATE INDEX ON writeamp_5idx (a); CREATE INDEX ON writeamp_5idx (b);
CREATE INDEX ON writeamp_5idx (c); CREATE INDEX ON writeamp_5idx (d); CREATE INDEX ON writeamp_5idx (e);
-- both tables pre-loaded with 1,000,000 rows each
EXPLAIN (ANALYZE, BUFFERS)
INSERT INTO writeamp_1idx (id, a, b, c, d, e)
SELECT g, g%1000, g%1000, g%1000, g%1000, g%1000 FROM generate_series(1000001, 1010000) g;
EXPLAIN (ANALYZE, BUFFERS)
INSERT INTO writeamp_5idx (id, a, b, c, d, e)
SELECT g, g%1000, g%1000, g%1000, g%1000, g%1000 FROM generate_series(1000001, 1010000) g;
Real result for the identical 10,000-row insert: against the single-index table, Buffers: shared hit=20343 read=11 dirtied=108 written=101, 10.2 ms. Against the six-index table, Buffers: shared hit=119263 read=1139 dirtied=1228 written=101, 118.6 ms: about 5.9x more buffer touches and 11.4x more dirtied pages for the same row count, from index maintenance alone. That is the concrete confirmation step: if this same test against logs shows a comparable gap once you strip the query down to a plain INSERT, the indexes are genuinely the bottleneck, not a coincidence in timing.
Mitigation, without losing any index you still need
- Batch, don't drop, first. If the application is doing one
INSERTper row, switching toCOPYor wrapping many rows into fewer, larger transactions reduces per-statement and per-commit overhead across the board; it does not reduce the number of index entries written, but it amortizes the fixed cost around them. - Drop what's actually unused, permanently. An index with
idx_scan = 0over a representative period isn't "needed" today; removing it has no read-side cost and immediate write-side benefit. - For indexes you do need for reads, but can tolerate a short gap on:
DROP INDEX CONCURRENTLYright before a bounded, scripted catch-up load,CREATE INDEX CONCURRENTLYimmediately after, with the rebuild step automated and monitored (alerting if it doesn't complete), so the index is briefly absent on a known schedule, never accidentally forgotten.
Trade-offs and pitfalls
Any window where a needed index is absent is a window where queries that depended on it either get slow or, for a uniqueness constraint, lose that guarantee entirely; a table serving live user-facing lookups needs either an off-peak window for the drop-rebuild approach or a different mitigation altogether. Batching into fewer, larger transactions also means a mid-batch failure loses more uncommitted work than smaller transactions would, so batch size should be chosen with a realistic failure/retry story in mind, not just for maximum throughput.
You're building on a NoSQL key-value store that has no native secondary-index feature, and the application needs to look up records efficiently by an attribute other than the primary key. Design an indexing approach that supports this at scale, and explain the consistency, write-amplification, and hot-key risks your design introduces as write volume grows.
Sample Answer
Direct answer: Build the index as its own key-value (KV) collection: a second set of items keyed by the attribute you want to look up by (or a hash of it), whose value holds the matching primary key(s). Every write to the base item becomes two writes, one to the base item and one to its index entry, and the central design decisions are (a) whether those two writes happen synchronously in the request path or asynchronously via a change log, and (b) how you prevent a popular attribute value from concentrating too many writes onto one physical index partition.
The pattern: an inverted index as a second collection
For a base item stored at key item:<id> and an attribute email you need to look up by:
- Index collection key:
idx:email:<email_value> - Index collection value: the set of matching primary keys (usually just one, if
emailis meant to be unique; a list/set if not)
A lookup by email becomes: read idx:email:<email_value> to get the primary key(s), then read each item:<id> by primary key, the store's one native fast operation. This is exactly the shape DynamoDB's own Global Secondary Indexes and Cassandra's native 2i implement internally (a separate keyed structure that maps indexed-value to primary key); the difference here is you're building and maintaining that structure yourself because the underlying store doesn't offer it.
Keeping the two writes consistent
- Synchronous dual write (in the request path). The application writes the index entry and the base item as part of handling the request, ideally through whatever the store offers closest to a transaction (a conditional/compare-and-swap write, or a native multi-key transaction if the store has one). This gives read-your-own-write consistency immediately, at the cost of coupling the base write's availability and latency to the index write's: if the index write fails after the base write succeeds (or a process crashes between the two), the index silently drifts out of sync with no automatic recovery.
- Asynchronous propagation (via a change log/stream). The application writes only the base item; a separate consumer reads a change log (an append-only stream of "item X changed" events, the same idea as change-data-capture, CDC) and applies the corresponding index write afterward, idempotently (safe to re-apply the same change twice without corrupting state, usually by making the index write a last-write-wins upsert keyed by a version or timestamp). This decouples the base write's latency and availability from index maintenance, and survives partial failures by simply retrying the log entry, at the cost of a real consistency lag: a read immediately after a write may not see it reflected in the index yet.
- Reconciliation. Whichever approach you pick, run a periodic consistency-check job that compares a sample of base items against their expected index entries and repairs drift; the synchronous approach needs this for the "crashed mid-write" case, and the asynchronous approach needs it as a standing safety net against a stuck or lossy consumer.
Consistency, write amplification, and hot-key risk as write volume grows
- Consistency: synchronous dual-write gives strong-ish consistency (bounded by whatever atomicity the store's conditional write actually guarantees, which for a pure KV store is usually "one key at a time," so a true two-key atomic write may not exist and you're really doing best-effort ordering plus reconciliation). Asynchronous propagation is explicitly eventually consistent, and the lag grows under load exactly when you most need the index to be fresh (a traffic spike).
- Write amplification: every base write becomes at least 2 physical writes (1 base + 1 index), growing linearly with the number of indexed attributes; a base item indexed on 3 attributes is 4 writes per logical update. This tax is unavoidable, since it's the same fundamental cost every managed secondary-index feature pays; the only choice is whether YOUR system or the DATABASE's internals absorb it.
- Hot-key risk: if the indexed attribute has low cardinality (a
statusfield with 3 values, a country code with a handful of common values), a large share of index writes and reads collapse onto a small number of index keys, each living on one physical partition. Concrete point of reference: AWS documents DynamoDB's own per-partition ceiling at 3,000 read-capacity-units/second and 1,000 write-capacity-units/second; the same physical constraint (one partition, one set of disks/CPU, a hard ceiling) exists in any partition-per-key infrastructure, including a hand-rolled one, even if the exact numbers differ. Push enough writes at one index key and you hit that ceiling long before the rest of the cluster is under any real load.
Mitigation as write volume grows
- Write (key) sharding. Append a bucket suffix, random or computed (e.g., a hash of the primary key modulo N), to hot index keys:
idx:status:pending#7instead ofidx:status:pending. Writes spread across N physical index partitions instead of one; reads for "all pending items" now have to fan out across N buckets and merge results, trading read simplicity for write scalability. Choose N based on the ceiling you're targeting divided by expected peak write rate for that value, not an arbitrary round number. - Bounded fan-out per index entry. If an index key's value is a growing list (many primary keys per indexed value), cap and paginate it rather than letting one index item grow unbounded; an unbounded list under one key is itself a form of the same hot-key problem, now expressed as item size instead of throughput.
- Skip indexing what doesn't need it. If an attribute is low-cardinality enough that the mitigation above becomes the dominant complexity, a full or filtered scan may genuinely be cheaper than a hand-built index that needs its own sharding scheme to survive; don't build the index reflexively just because the requirement says "look up by X."
Trade-offs and pitfalls
- This pattern is exactly what a managed secondary index gives you for free, plus the operational burden of writing and running the propagation and reconciliation logic yourself; before building it, confirm the store really has no native option (some "pure KV" stores add limited secondary-index or search features over time).
- A synchronous dual write without a real cross-key transaction is not actually atomic; be explicit with your team about what failure mode you're accepting (a crash between the two writes leaves a stale or missing index entry) and build the reconciliation job as a first-class part of the design, not an afterthought.
- Async propagation needs idempotent application logic; without it, a replayed log entry after a retry can apply an update twice or apply events out of order, corrupting the index in a way that's hard to notice until a lookup returns a stale or wrong primary key.
Given a table events(event_id PK, user_id int, event_type text, occurred_at timestamptz), write SQL (Postgres syntax) to create a composite index to efficiently support queries like:
SELECT * FROM events WHERE user_id = ? AND occurred_at >= ? ORDER BY occurred_at DESC LIMIT 50;
Explain the choice and column order for the composite index.
Sample Answer
Direct answer
CREATE INDEX idx_events_user_occurred ON events (user_id, occurred_at DESC);
user_id leads because the query filters on it with equality (=), which is the most selective (narrowest-matching) predicate here; occurred_at comes second, in DESC order, because it is a range predicate (>=) combined with an ORDER BY ... DESC LIMIT 50. Putting the equality column first lets the index narrow straight down to one user's rows; putting occurred_at DESC second means those rows are already sorted in the exact order the query wants, so no separate sort step and no early cutoff before LIMIT 50 is satisfied.
Structured elaboration
Why not (occurred_at, user_id) instead? Because the equality predicate should lead. A composite B-tree index can only use its columns efficiently in prefix order: leading with occurred_at would make the index a large range covering essentially the whole time period, inside which every single user_id is intermixed, so the database would still have to check every row in that range against user_id = ?. Leading with user_id narrows to one user's rows immediately, a far smaller set to then range-filter and sort.
Why DESC on the sort column, specifically. The query asks for the most recent events first (ORDER BY occurred_at DESC LIMIT 50). If the index stores occurred_at in DESC order for each user_id, walking the index from the start of a user's range hands back rows in exactly that output order, so the database can stop as soon as it has 50 rows, without reading further or sorting anything in memory.
What the >= range predicate does inside this design. Once positioned at a user's rows in occurred_at DESC order, the database walks forward and simply stops once it hits a row with occurred_at below the >= threshold, since everything after that point is guaranteed to be out of range too, given the sort order.
Worked example
Table: events(event_id, user_id, event_type, occurred_at), 1,000,000 rows. Query:
SELECT * FROM events
WHERE user_id = 897768 AND occurred_at >= '2025-01-01'
ORDER BY occurred_at DESC
LIMIT 50;
Before any supporting index:
Limit (cost=14603.21..14603.22 rows=2 width=27) (actual time=22.381..23.777 rows=9 loops=1)
-> Sort
Sort Key: occurred_at DESC
-> Gather
-> Parallel Seq Scan on events (actual time=6.126..20.417 rows=3 loops=3)
Filter: ((occurred_at >= '2025-01-01 00:00:00+00'::timestamptz) AND (user_id = 897768))
Rows Removed by Filter: 333330
Execution Time: 23.811 ms
After creating the composite index above:
Limit (cost=0.42..12.46 rows=2 width=27) (actual time=0.043..0.110 rows=9 loops=1)
-> Index Scan using idx_events_user_occurred on events (actual time=0.042..0.109 rows=9 loops=1)
Index Cond: ((user_id = 897768) AND (occurred_at >= '2025-01-01 00:00:00+00'::timestamptz))
Execution Time: 0.138 ms
The estimated cost dropped from roughly 14,600 to 12.46, and the separate Sort step disappeared entirely: the index already returns rows in the needed order, so the plan goes straight from Index Scan to Limit. Observed execution time in this one run dropped from about 23.8 ms to about 0.14 ms, consistent with reading a small, targeted slice of the index instead of scanning and sorting roughly a third of a million rows.
A different query shape against the same table is worth contrasting: SELECT event_type, COUNT(*) FROM events WHERE user_id = ? AND occurred_at >= ? GROUP BY event_type ORDER BY COUNT(*) DESC;. This same (user_id, occurred_at DESC) index still narrows down to the right rows efficiently, since the WHERE clause is identical in shape, but it stops helping past that point: GROUP BY event_type and ORDER BY COUNT(*) need their own aggregation and sort step over whatever rows the index handed back, because neither event_type nor a count is part of this index's key. The index earns its keep on the filtering half of the query, not the aggregating half, which is a useful distinction to keep in mind: a composite index designed for a point-lookup-plus-sort pattern does not automatically extend its benefit to a GROUP BY pattern layered on top of the same filter.
Trade-offs & pitfalls
This index is shaped for exactly this query pattern (one user, a time floor, most-recent-first, capped). A query that instead wants ALL of a user's events regardless of time, or wants them oldest-first, is still served reasonably (Postgres can scan a B-tree index backward too), but a query that filters by event_type instead of, or in addition to, user_id gets no benefit from this index at all, since event_type is not a leading column here; that would call for either widening this index (at the cost of size and write overhead) or building a second one, not reusing this one as-is. A common mistake is to build the index (user_id, occurred_at) ascending and assume it serves the DESC case for free: it usually does, via a backward index scan, but always confirm with EXPLAIN rather than assuming, especially once multiple sort columns are involved.
Explain the difference between an index scan (index seek) and a sequential scan. Given an example query that filters on a non-indexed column and takes 30s, how would you explain to a non-technical stakeholder why adding an index might reduce report latency?
Sample Answer
Direct answer
An index scan (often called an "index seek" in some database products) finds rows by first consulting a small, sorted lookup structure, then going straight to only the rows that match. A sequential scan reads every single row in the table, in order, and checks each one against the filter, whether or not it matches. To a non-technical stakeholder: imagine looking up a name in a phone book (index scan, jump straight to the right page) versus reading every entry in the phone book cover to cover to find every instance of that name (sequential scan). A report that takes 30 seconds and filters on a column with no supporting index is doing the second thing, checking every row in the table one at a time, and adding an index is often the difference between "read every row" and "read only the ones that matter."
Structured elaboration
The non-technical explanation, in full. A database table with millions of rows is like a massive, unsorted filing cabinet. Asking "find me the orders for this one product" without an index means checking every single folder in the cabinet, one at a time, to see if it's a match. An index is a separate, sorted card catalog that says exactly where in the cabinet each product's orders live, so the search becomes "look up the card, go straight to the right drawer" instead of "check every folder." The bigger the filing cabinet, the bigger that difference gets: doubling the table roughly doubles the sequential-scan search time, but barely changes the index-lookup time at all, because the index only grows by a few extra "levels" of sorting.
The honest counter-case: adding an index does NOT always help. This is the part that's easy to oversell to a stakeholder who just heard "indexes make things fast." If a filter matches a large share of the rows (not "one specific product" but "all orders placed in the last two years," when the table only goes back three), the card catalog doesn't save much: you still end up pulling most of the folders anyway, plus you now paid for the extra step of consulting the catalog first. Worse, every index has to be kept up to date every time a new folder is added to the cabinet or an existing one is changed, so an index that rarely helps searches is pure ongoing cost with no offsetting benefit: slower writes, more storage, for a search pattern it was never actually good at speeding up.
Worked example
The "adding an index helps" case: order_items(order_item_id, order_id, product_id, quantity, order_date), 800,000 rows, searching for one specific product out of 5,000 distinct products (a highly selective, narrow-matching filter):
EXPLAIN (ANALYZE, BUFFERS) SELECT order_item_id, quantity FROM order_items WHERE product_id = 3141;
Before an index: Parallel Seq Scan on order_items (actual execution time 10.722 ms, reading 5,883 buffer pages, most of the table, to find 162 matching rows out of 800,000). After CREATE INDEX idx_order_items_product_id ON order_items (product_id);: Bitmap Heap Scan using the new index (actual execution time 1.555 ms, reading only 164 buffer pages). Roughly a 7x reduction in this run, by going straight to the matching rows instead of checking all 800,000.
The counter-case: the same table's quantity column has only 5 distinct values (1 through 5), so WHERE quantity = 3 matches roughly 160,000 of the 800,000 rows, about 20%, a filter that is NOT narrow:
CREATE INDEX idx_order_items_quantity ON order_items (quantity);
EXPLAIN (ANALYZE, BUFFERS) SELECT order_item_id FROM order_items WHERE quantity = 3;
With the index present and chosen by the optimizer: 90.916 ms. Forcing a plain scan of the whole table for direct comparison: 28.008 ms, meaning in this run the "have an index and use it" plan was actually SLOWER than reading the entire table straight through. This is the real, measured proof of the counter-case: a card catalog that has to point you to a fifth of the filing cabinet anyway isn't saving much, and the extra step of consulting it can cost more than it saves.
Trade-offs & pitfalls
When explaining this to a non-technical stakeholder, resist the urge to promise "we'll just add an index and it'll be fast," since that promise is only true for narrow, highly selective searches (find one specific thing among many), not for broad ones (find a large chunk of everything). The more useful, honestly-framed message is: how specific is the thing we're searching for, relative to the whole dataset? The more specific, the more an index helps; the broader the search, the less it helps, and sometimes it isn't worth the ongoing cost of maintaining it at all.
Explain how database statistics and histograms influence the optimizer's choice of index or join order. How would you diagnose and fix a query that does a full table scan due to stale or absent statistics?
Sample Answer
Direct answer
The query optimizer decides whether to use an index (and which join order to pick) mostly by estimating how many rows each step of a plan will produce, and it gets those estimates from stored statistics: a null fraction, a distinct-value count, a most-common-values list, and a histogram of the rest of the distribution, all captured the last time ANALYZE ran (Postgres also runs this automatically via autovacuum's analyze component). When those statistics are stale, meaning the data has changed shape since the last ANALYZE but the stored numbers haven't been refreshed, the optimizer's row estimates become wrong, and a wrong estimate can flip its choice away from an index it should be using, or toward one it shouldn't. Diagnosing it starts with EXPLAIN ANALYZE, comparing the planner's ESTIMATED row count against the ACTUAL row count the query really returned: a large gap is the signature of stale (or entirely absent) statistics, and the fix is almost always to run ANALYZE on the affected table.
Structured elaboration
What statistics feed the optimizer. For each column, Postgres's planner statistics (queryable via pg_stats) include: null_frac (share of NULLs), n_distinct (estimated distinct values), a most-common-values array with their frequencies, and a histogram of the remaining value distribution. Multi-table plans also use these to estimate join output sizes, which is how a bad single-column estimate can cascade into a bad join order for an entire query.
Why staleness causes a full scan specifically. If the true, current distribution of a column has drifted so that a value the optimizer THINKS is common (from old statistics) is now actually rare, the optimizer will underestimate how selective a predicate on that value really is, and it may prefer a sequential (full-table) scan, reasoning that "this predicate barely narrows anything, so scanning everything and filtering is cheaper than the overhead of an index probe." The index was available the whole time; the optimizer's belief about the data was wrong.
What actually goes stale, precisely. It's worth being exact here: Postgres refreshes a table's approximate row COUNT and page count automatically at planning time from the relation's live size on disk (so gross growth in ROW COUNT is usually reflected even without a fresh ANALYZE), but the DISTRIBUTION statistics (the most-common-values list, the histogram, n_distinct) are frozen exactly as they were at the last ANALYZE until a new one runs. That is the real, specific thing that goes "stale": not "the table looks small" but "the optimizer's belief about which values are common has drifted from reality."
Worked example
Seeded on Postgres 16: a 1,000,000-row table where status = 'flagged' originally covered 50 percent of rows (a deliberately unselective value, so the optimizer correctly avoids using the index and instead does a bitmap-assisted scan reading most of the table, which is the right call at 50 percent selectivity):
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, amount FROM stale_demo WHERE status = 'flagged';
-- Bitmap Heap Scan, actual rows=499946
-- Execution Time: 65.352 ms (correct plan for 50% selectivity)
Then almost all of the 'flagged' rows were deleted, leaving only 1,000 out of 1,000,000 (0.1 percent), WITHOUT running ANALYZE afterward:
DELETE FROM stale_demo WHERE status = 'flagged' AND id NOT IN (
SELECT id FROM stale_demo WHERE status='flagged' ORDER BY random() LIMIT 1000
);
-- status | count
-- flagged | 1000
-- normal | 500054
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, amount FROM stale_demo WHERE status = 'flagged';
-- Bitmap Heap Scan, cost=5618.43..18288.42 rows=504000 <- estimate still says 504,000!
-- actual rows=1000 <- but only 1,000 really matched
-- Execution Time: 39.138 ms, Buffers: shared hit=6793 <- touched nearly the whole table
The plan SHAPE and the COST ESTIMATE are unchanged from before the delete (still rows=504000, the stale most-common-values entry), even though the real data is now 500x more selective than the optimizer believes. Because the plan still assumes half the table matches, it scans nearly the whole thing (6,793 buffers touched) to find 1,000 rows, and it's carrying dead index entries from the deleted rows on top of that.
ANALYZE stale_demo;
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, amount FROM stale_demo WHERE status = 'flagged';
-- Index Scan, cost=0.42..68.72 rows=952 <- now close to the real 1,000
-- Execution Time: 21.267 ms, Buffers: shared hit=7214
The cost estimate collapsed from 18,288 to 68.7 and the row estimate corrected from 504,000 to 952 (close to the true 1,000), and the plan switched from a bitmap scan to a plain, cheap Index Scan. Execution time is still elevated at 21.267 ms because the index itself is carrying bloat from the mass delete (dead entries ANALYZE doesn't clean up); running VACUUM afterward brought it down to 1.980 ms with the same correct plan, which is the separate, complementary fix: ANALYZE corrects the PLAN CHOICE, VACUUM reclaims the PHYSICAL SPACE.
Trade-offs & pitfalls
Diagnostic checklist for "the plan is doing a full scan and I think it shouldn't be":
- Run
EXPLAIN ANALYZE(not justEXPLAIN) and compare the estimated row count in the plan against the actual row count it reports. A large mismatch (an order of magnitude or more) is the tell. - Check
pg_statsfor the column in question: does the most-common-values list or histogram look like it reflects the CURRENT data, or an old distribution? - Check
last_analyze/last_autoanalyzeinpg_stat_user_tablesfor that table: if it's old relative to how much the data has changed, that confirms staleness. - Run
ANALYZEon the table and re-check the plan. If the plan corrects itself, staleness was the cause. - If the table changes shape often and rapidly (heavy deletes, bulk loads, skewed updates), consider lowering
autovacuum_analyze_scale_factorfor that table so autovacuum re-analyzes more eagerly, rather than relying on manual intervention every time.
A gap this large between estimated and actual rows will often mislead the optimizer on JOIN ORDER too, not just single-table scan choice: an underestimated row count for one side of a join can make the optimizer pick a nested-loop join it thinks will only execute a handful of times, when the real row count makes that loop run far more often than planned, which is a much more expensive failure mode than a single missed index.
Unlock Full Question Bank
Get access to all Indexing Strategy and Design interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.