query went from 200ms to 8s after adding a WHERE clause
Postgres 15.4. Had a query on orders (~2M rows) that ran in ~200ms. Added WHERE status = 'open' and now it's 8 seconds. There's an index on created_at which I sort by. EXPLAIN ANALYZE shows a Seq Scan on orders. Why would adding a filter make it abandon the index? Stats are vacuumed and analyzed recently.
3 replies