On a two-column btree index, we can constrain the first column with equality and read the rows in order by the 2nd column. But we can't constrain the first column by IS NULL and still read the rows in order by the 2nd column. But why not? Surely the structure of the btree index would allow for this to work.
Example: create table if not exists j as select case when random()<0.9 then floor(random()*10)::int end b, random() c from generate_series(1,1000000); create index if not exists j_b_c_idx on j (b,c); set enable_sort TO off; explain analyze select * from j where b is null order by c limit 10; explain analyze select * from j where b =8 order by c limit 10; The first uses a sort despite it being disabled. Cheers, Jeff