Mar 12, 2026 · 5 min read

Postgres Indexing That Actually Moves Latency

#postgres#performance#indexing

Measure first

“Add indexes everywhere” was worse than waiting for slow query logs. Index on paths you actually filter and join.

High-value patterns

  • Foreign keys used in JOIN and WHERE
  • Composite indexes matching common filters, e.g. (user_id, created_at DESC)
  • Avoid low-selectivity single-column indexes that never get used

After adding an index

  1. EXPLAIN (ANALYZE, BUFFERS) the slow query
  2. Watch write amplification on insert-heavy tables
  3. Drop unused indexes later - they are not free

An 80ms query target is a product requirement. Indexes are how you keep that promise as rows grow.

Index the query, not the table.