Re: BUG #18442: Unnecessary Sort operator in indexScan Plan - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Date
Msg-id CAApHDvrX8AUj=5O-frg6nAEwa_CTzgsnSg80Cz3ReS7d7B94og@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18442: Unnecessary Sort operator in indexScan Plan  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, 22 Apr 2024 at 14:25, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> (A question closely related to this is whether IS NOT DISTINCT FROM
> could be optimized more like regular equality.  I'm not convinced
> about the use-case there either, although perhaps it's worth looking
> into.)

This came up for me recently when adjusting the UNION planner to allow
the use of Merge Append.  I'd considered taking that work further to
expand it into INTERSECT and EXCEPT to transform those to INNER and
ANTI joins. I quickly realised that we'd need to have better
optimisation of joins with IS NOT DISTINCT FROM to make this a
worthwhile transformation.  The join transformation cannot be done
with simple equality conditions as that would eliminate NULLs. I was
unexcited about only making it work for non-nullable Vars as it seemed
like a backwater within a backwater.

David



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #15954: Unable to alter partitioned table to set logged
Next
From: Michael Paquier
Date:
Subject: Re: BUG #15954: Unable to alter partitioned table to set logged