"Dan Weber" <weberdan@xxxxxxxxx> writes: > I have the following query: > SELECT columns FROM my_table WHERE (bool_1 or int_1 = 0) > AND (int_2 IS NULL) AND (int_3 IS NULL) AND (protocol = > 2) ORDER BY id LIMIT 1; > I made an expression index specifically for that where clause: > CREATE INDEX special_testing_idx on my_table (((bool_1 or > int_1 = 0) AND (int_2 IS NULL) AND (int_3 IS > NULL) AND (protocol = 2))); A partial index would be WAY more useful than that: create index on my_table(id) where (bool_1 or int_1 = 0) ... regards, tom lane