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
31 practiced

You observe index-only scans are not occurring even though a covering index exists on the table. What could cause this, and what would you check or change to get index-only scans happening in Postgres?

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.

MediumTechnical
33 practiced

Many single-column indexes exist on a high-write table causing heavy write amplification. Propose a methodology to decide which indexes to consolidate into composite or covering indexes and which to drop. Include metrics and safety checks for a non-production rollout.

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.

MediumTechnical
59 practiced

Which indexes help speed up GROUP BY queries? For query SELECT customer_id, SUM(amount) FROM orders WHERE created_at >= '2025-01-01' GROUP BY customer_id; discuss whether a single-column index on created_at, a composite index on (created_at, customer_id) or a covering index would be most beneficial and why. Mention cases where the index won't help.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.