Re: function calls optimization - Mailing list pgsql-hackers

From Jim Finnerty
Subject Re: function calls optimization
Date
Msg-id 1572537382433-0.post@n3.nabble.com
Whole thread Raw
In response to Re: function calls optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I recently implemented something closely related to this.  Combining and
migrating expensive STABLE user-defined functions to the FROM clause, where
the function is evaluated as a lateral join (or "cross apply").  I'm
defining expensive as 50x times more expensive than the default function
cost.

For functions that return multiple outputs and where the query uses (...).*
notation, this will, for example, consolidate all of the calls in the *
expansion into a single call.  It also looks in the WHERE clause and HAVING
clause, and combines those references, too.  Currently it requires the
function to be in a top-level AND condition, if it appears in a predicate.

I think I can get permission for contributing it back.  If there's an
interest in it, let me know.



-----
Jim Finnerty, AWS, Amazon Aurora PostgreSQL
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: function calls optimization
Next
From: Andres Freund
Date:
Subject: Re: Allow cluster_name in log_line_prefix