Re: Discussion on missing optimizations

Ants Aasma <ants.aasma@eesti.ee>

From: Ants Aasma <ants.aasma@eesti.ee>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Petr Jelinek <petr.jelinek@2ndquadrant.com>, Andres Freund <andres@anarazel.de>, Adam Brusselback <adambrusselback@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-10-09T14:08:05Z
Lists: pgsql-hackers
On Sun, Oct 8, 2017 at 7:24 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Petr Jelinek <petr.jelinek@2ndquadrant.com> writes:
>> Okay, that makes sense, thanks for explanation. Your patch is the way to
>> go then.
>
> Hearing no further comment, pushed.  Thanks for reviewing it.

The tautological col = col comparison on is occasionally used as a
planner "hint" to correct for row count overestimates. Not a great
solution, but PostgreSQL doesn't really have a better way to guide the
planner. Those queries will now have to do something else, like col =
col + 0, which still works.

Regards,
Ants Aasma


Commits

  1. Reduce "X = X" to "X IS NOT NULL", if it's easy to do so.