Postgres partial index on IS NULL not working
0
CREATE TABLE tickets ( id bigserial primary key, state character varying, closed timestamp ); CREATE INDEX "state_index" ON "tickets" ("state") WHERE ((state)::text = 'open'::text)); A query with a condition on state performs well using an index scan as expected: explain analyze select * from tickets where state = 'open'; Index Scan using state_index on tickets (cost=0.29..16093.57 rows=36599 width=212) (actual time=0.025..22.875 rows=37346 loops=1) Planning time: 0.212 ms Execution time: 25.697 ms I am trying to achieve the same or better performance for the query with the condition closed IS NULL : select * from tickets where closed IS NULL; However, my partial indexes does not result in a single index scan like the first query.