Re: function calls optimization - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: function calls optimization
Date
Msg-id a2bc0407-a41e-7798-0129-d38a7bd5e359@proxel.se
Whole thread Raw
In response to Re: function calls optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 10/31/19 3:45 PM, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
>> On October 31, 2019 7:06:13 AM PDT, Andrzej Barszcz <abusinf@gmail.com> wrote:
>>> 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.

That is an important concern, but given how SQL does not make it 
convenient to re-use partial results of calculations I think such 
queries are quite common in real world workloads.

So if we can make it cheap enough I think that it is a worthwhile 
optimization.

Andreas



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: function calls optimization
Next
From: Tom Lane
Date:
Subject: Re: function calls optimization