Re: function calls optimization - Mailing list pgsql-hackers

From Andres Freund
Subject Re: function calls optimization
Date
Msg-id EC3B2F1D-A065-445F-A028-50E2677844B8@anarazel.de
Whole thread Raw
In response to Re: function calls optimization  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi

On October 31, 2019 7:53:20 AM PDT, Andres Freund <andres@anarazel.de> wrote:
>On October 31, 2019 7:45:26 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>We've typically supposed that the cost of searching for duplicate
>>subexpressions would outweigh the benefits of sometimes finding them.
>
>Based on profiles I've seen I'm not sure that's the right choice. Both
>for when the calls are expensive (say postgis stuff), and for when a
>lot of rows are processed.
>
>I think one part of doing this in a realistic manner is an efficient
>search for redundant expressions.

One way to improve the situation - which is applicable in a lot of situations, e.g. setrefs.c etc - would be to compute
hashesfor (sub-) expression trees. Which makes it a lot easier to bail out early when trees are not the same, and also
easierto build an efficient way to find redundant expressions. There's some complexity in invalidating such hashes once
computed,and when to first compute them, obviously. 

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



pgsql-hackers by date:

Previous
From: Ibrar Ahmed
Date:
Subject: Re: [BUG] Partition creation fails after dropping a column and addinga partial index
Next
From: Andreas Karlsson
Date:
Subject: Re: function calls optimization