InterviewStack.io LogoInterviewStack.io

Indexing Strategy and Design Questions

Choosing and designing indexes: B-tree, hash, composite, covering, and partial indexes, and the trade-offs between read acceleration and write/storage overhead. Covers selecting index columns from query patterns, cardinality and selectivity reasoning, and diagnosing why an index is or is not used. Central to database performance interviews.

MediumTechnical
44 practiced

Given a Postgres table events(event_id UUID PK, user_id UUID, event_type text, payload JSONB, occurred_at timestamptz), describe index and schema choices to efficiently support: (a) recent events per user, (b) filtering by event_type and time range, (c) queries that inspect specific keys inside payload. Include recommended index types (GIN, partial, expression) and rationale.

MediumTechnical
32 practiced

Explain database indexing in detail using: (1) a simple definition of an index, (2) step-by-step explanation of how B-tree indexes work vs hash indexes and the effects on reads/writes, (3) real-world examples (primary key index, composite indexes, covering index for queries), (4) discuss trade-offs (space, write overhead, selectivity) and why indexing matters for query performance.

MediumTechnical
44 practiced

Explain how composite (multi-column) indexes work and how the order of columns affects query usage. Given table orders(id, user_id, status, created_at) and queries that filter by (user_id, status) and order by created_at DESC, recommend composite index(es) and explain selectivity and ordering implications.

That is every published Indexing Strategy and Design question for Software Engineer so far. Browse the other topics in this category, or practice this one interactively.