Andres Freund <andres@anarazel.de> writes:
> On October 31, 2019 7:06:13 AM PDT, Andrzej Barszcz <abusinf@gmail.com> wrote:
>> I almost finished patch optimizing non volatile function calls.
>>
>> select f(t.n) from t where f(t.n) > 10 and f(t.n) < 100; needs 3 calls
>> of
>> f() for each tuple,
>> after applying patch only 1.
>>
>> Any pros and cons ?
> Depends on the actual way of implementing this proposal. Think we need more details than what you idea here.
We've typically supposed that the cost of searching for duplicate
subexpressions would outweigh the benefits of sometimes finding them.
regards, tom lane