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.

EasyTechnical
38 practiced

Define index selectivity and cardinality. Given a customers table with 1,000,000 rows and a column 'country' with 5 unique values and a column 'customer_id' with 1,000,000 unique values, explain which column is a better candidate for an index and why. Also explain how selectivity affects optimizer choice.

EasyTechnical
34 practiced

List the common index types you'd choose among (B-tree, hash, GIN/GiST, bitmap) and explain when you'd reach for each. Mention any important platform-specific caveats (for example Postgres's hash-index history).

MediumTechnical
41 practiced

You are given a query that runs slowly: it filters on LOWER(email) = 'abc@example.com'. Explain why this may prevent index usage and propose alternatives to make lookups case-insensitive while remaining sargable. Include SQL examples and index recommendations for PostgreSQL.

MediumTechnical
42 practiced

Explain the difference between a clustered index and a nonclustered index. Use an orders table example where queries often filter by customer_id but the primary key is order_id. Discuss implications for physical layout, read performance, and insert/update cost, and name two databases with different clustered-index semantics.

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.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.