Re: missing optimization - column <> column - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: missing optimization - column <> column
Date
Msg-id CADkLM=ciBNo8Q2adv6VJBAX_2SHGd3pbggKaeFKnsM730mCZDw@mail.gmail.com
Whole thread Raw
In response to Re: missing optimization - column <> column  (Pantelis Theodosiou <ypercube@gmail.com>)
Responses Re: missing optimization - column <> column
List pgsql-hackers

Would it be worth replacing the condition with the equivalent?
I mean would that help optimizing better some queries when it knows that a is (not) nullable or when "a" is more complicated expression?

a <> a    :   (a IS NULL) AND NULL
a = a     :   (a IS NOT NULL) OR NULL


I think you're looking for

a IS DISTINCT FROM a 

And that will work for cases where a might be null.

I have no opinion about whether adding such a test to the planner is worth it.

pgsql-hackers by date:

Previous
From: Mithun Cy
Date:
Subject: Re: Patch: Implement failover on libpq connect level.
Next
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.