Why don't multi-column indices help queries on the second column?

224 · Huon Wilson · March 23, 2026, 4:37 a.m.
Summary
This blog post discusses multi-column indices in SQL databases, highlighting their performance implications based on column order. It illustrates why multi-column indices can dramatically speed up queries that use the first indexed column while having little effect on queries that only involve later columns. The author provides a benchmarking example with PostgreSQL, demonstrating the significant performance gains achieved with various indexing strategies, especially in scenarios specific to a sample app focused on cutlery. It also offers insights into underlying database mechanics that impact query performance.