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.

HardTechnical
31 practiced

Interpret this execution plan fragment (Postgres-like):

Seq Scan on orders (cost=0.00..1000.00 rows=100000 width=64) (actual time=0.05..1200.00 rows=100000 loops=1)
Filter: (customer_id = 42)

Nested Loop (cost=0.00..50.00 rows=10 width=64) (actual time=0.10..5.00 rows=10 loops=1)
-> Index Scan using idx_customers on customers ...

Why might the planner choose a Seq Scan despite an index existing, and why is the actual runtime so large? List diagnostic steps and fixes.

EasyTechnical
58 practiced

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.

HardTechnical
34 practiced

You discover that queries against a large fact table are slowed by many small index range scans caused by low-selectivity predicates. What alternatives would you consider, and how would you choose between them?

EasyTechnical
57 practiced

Explain what a B-tree index is and why adding an index on customer_id in a large orders table might speed up lookups but slow down inserts. Include impact on storage, and how index choice changes read/write trade-offs for BI reporting vs OLTP.

HardSystem Design
37 practiced

Design full-text search indexing for an international product catalog: requirements include fuzzy matching, multilingual support (English, Japanese), ranking by relevance and popularity, and low-latency autocomplete. What index choices and trade-offs would you consider, and when would you offload to an external search engine instead?

Unlock Full Question Bank

Get access to all Indexing Strategy and Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.