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

From Tom Lane
Subject Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Date
Msg-id 2909005.1713752742@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #18442: Unnecessary Sort operator in indexScan Plan  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
List pgsql-bugs
David Rowley <dgrowleyml@gmail.com> writes:
> Couldn't strict equality conditions be handled using the same method
> that we use to handle an Eclass with two distinct Consts. e.g a = 1
> and a=b and b=2?

Perhaps, but it'd be a bit odd and confusing to treat two NULLs as
distinct rather than equal.

On the whole I'm disinclined to add complexity around this.  My gut
says there are more semantic gotchas than this one, and I think the
use-case is at best pretty hokey.  If your data design requires using
NULL as though it's a normal data value, you're in a state of sin
already, and you're going to find SQL fighting you all the way.

(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.)

            regards, tom lane



pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Next
From: Richard Guo
Date:
Subject: Re: BUG #18442: Unnecessary Sort operator in indexScan Plan