On Wed, May 23, 2018 at 12:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ah. That would work, though it'd make the number of subquery executions
> even less predictable (since some logically-equal values would compare
> as physically unequal).
In most cases that seems fine. It might not be fine with the subquery
contains volatile functions, though. I think I'd be sad if I wrote a
query expecting random() to be executing 26000 times and it got
executed 11 times instead. But if the optimizer finds a way to
execute int4pl fewer times, that seems like a good thing.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company