Re: function calls optimization

From: Jim Finnerty <jfinnert(at)amazon(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: function calls optimization
Date: 2019-10-31 15:56:22
Message-ID: 1572537382433-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-10-31 16:36:15 Re: Allow cluster_name in log_line_prefix
Previous Message Andres Freund 2019-10-31 15:52:53 Re: function calls optimization