Re: Index ordering after IS NULL - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Index ordering after IS NULL
Date
Msg-id CAH2-Wz=iDDL7H=rbgEiaHTXGEMTJ0Nhu8c4q9ZgOP1KfNna6Dg@mail.gmail.com
Whole thread Raw
In response to Index ordering after IS NULL  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
On Sat, Sep 10, 2022 at 2:28 PM Jeff Janes <jeff.janes@gmail.com> wrote:
> 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.

The first/is null query seems to give the result and plan you're
looking for if the query is rewritten to order by "b, c", and not just
"c".

That in itself doesn't make your complaint any less valid, of course.
You don't have to do this with the second query, so why should you
have to do it with the first?

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Michael Banck
Date:
Subject: Re: Support load balancing in libpq
Next
From: Robert Haas
Date:
Subject: Re: why can't a table be part of the same publication as its schema