Cookbook recipe

Why your query ignores the index (and how to fix it)

Applies to PostgreSQL 13–17 Last reviewed May 2026 Grounded in source
Estimated investigation4 min

Scenario

You created the perfect index but EXPLAIN still shows a sequential scan. The planner is not broken — something about the query or statistics is steering it away. Diagnose it Compare the estimate to reality: EXPLAIN…

Investigation Path

You created the perfect index but EXPLAIN still shows a sequential scan. The planner is not broken — something about the query or statistics is steering it away.

Diagnose it

Compare the estimate to reality:

EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM orders WHERE status = 'open';

Watch for a function or type mismatch wrapped around the column, or a wildly wrong row estimate.

This is a Pro lesson

Get every Learning Pathway and cookbook recipe — grounded in PostgreSQL source code, with diagnostics, fixes, and prevention for each topic.

Continue this lesson to learn:

  • Why it happens
  • How to fix it
  • Prevent it next time
  • Related & next steps
  • All 36 Learning Pathway lessons
  • 170+ cookbook recipes
  • Source-grounded diagnostics & fixes

Secure checkout Cancel anytime Source-grounded

Career Impact

This scenario builds production judgment and operational confidence under pressure.

Open Career Dashboard →

Keep going

Related & next steps

Was this helpful?

← All cookbook recipes