Why your query ignores the index, and how to fix it
You built the index and the planner still scans the table. The usual cause is a function on the column. Match the index to the expression and the scan drops from a parallel seq scan to a bitmap index scan on the same 10,000 matches.
Problem
What you're actually looking at
The symptom as it shows up on a real server.
An index on a column cannot be used when the query wraps that column in a function or cast, WHERE lower(status) = 'exception' cannot use a plain index on status. The planner falls back to a full scan.
A Meridian waybills query filters on lower(status). There is a plain index on status, but because the predicate calls lower() the planner ignores it and reads all 80,000 rows.
Simple terms
An index on a column only helps when you search that column exactly as it is stored. The moment you wrap it in a function, WHERE lower(status) = 'exception', you are no longer searching status, you are searching lower(status), and the plain index knows nothing about that transformed value. So PostgreSQL gives up on the index and reads the whole table. The fix is to build the index on the same expression the query uses, or to stop transforming the column inside the WHERE clause.
Full runbook for this incident
- The full identify checklist, the exact signals that tell you it's this incident
- Every diagnostic query; lab output is attached only to the steps we actually captured
- The resolution path and the pitfalls that make it worse
- Mitigation steps to stop it recurring, plus a verify-you're-done query
Card required. Cancel before day 7 and you are not charged.
More in this category
Other Query performance runbooks
Neighbouring incidents that share the same diagnostic surface.
Connected
How this connects to the rest of the library
A live view of this page's real cross-references, what explains it, what fixes it, what to tune, and where to go next. Every link is an authored relationship, not a guess.
Fixes these errors
Need the full procedure?
Pro runbooks finish the incident path
Free runbooks teach the shape. Pro opens the full step transcript, edge cases, and prevention depth.