Re: BUG #18442: Unnecessary Sort operator in indexScan Plan

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: hu_yajun(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Date: 2024-04-22 22:56:23
Message-ID: CAApHDvrX8AUj=5O-frg6nAEwa_CTzgsnSg80Cz3ReS7d7B94og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 22 Apr 2024 at 14:25, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2024-04-23 05:37:56 Re: BUG #15954: Unable to alter partitioned table to set logged
Previous Message David G. Johnston 2024-04-22 19:36:20 Re: BUG #15954: Unable to alter partitioned table to set logged