You have a slow query. You add an index. You run the query again, check the plan, and there it is: Seq Scan .
The usual reaction is "Postgres is ignoring my index." Sometimes that's true, and something is wrong. But a lot of the time, Postgres made the right call, and the real problem is somewhere else.
I reproduced four cases locally on Postgres 17 so we can look at real plans instead of guessing.
The Setup
A table of orders with a million rows. About 95% are completed and 5% are pending :
CREATE TABLE orders ( id serial PRIMARY KEY , customer_id int , status text , created_at timestamptz DEFAULT now () );
INSERT INTO orders ( customer_id , status , created_at ) SELECT ( random () * 10000 ):: int , CASE WHEN random () < 0 .…