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.

MediumTechnical
32 practiced

You have a JSONB column profile in users storing nested fields. Example query: SELECT id FROM users WHERE profile->'address'->>'city' = 'Seattle'. Write two different Postgres index strategies (functional b-tree and GIN) to accelerate this query and explain pros/cons of each.

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.

HardTechnical
39 practiced

Discuss when you would use a clustered columnstore index versus a nonclustered columnstore index in SQL Server for a large analytical fact table that receives frequent micro-batch loads. Explain how the delta store and tuple-mover affect query and load performance, and how you would structure data loads to minimize fragmentation.

HardTechnical
42 practiced

Discuss the trade-offs of adding covering indexes vs allowing index-only scans vs creating wide composite indexes. Consider index size, cache locality, write penalty, and cache eviction. Provide heuristics for when to choose each approach in a high-throughput OLTP environment.

HardTechnical
41 practiced

Discuss how secondary indexes are implemented in distributed NewSQL systems like CockroachDB or Spanner. Explain transaction implications, read/write amplification, how index-maintenance is coordinated across nodes, and the effect on latency for multi-region writes.

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.