Re: Want function to be called only once in query

2021-09-16 Thread Steve Pritchard
> Add the MATERIALIZED keyword to the WITH statement Many thanks Jim, that's just what I needed - that does the trick. It's hard to keep abreast of these SQL changes. Thank goodness for mailing lists! Steve On Thu, 16 Sept 2021 at 11:56, Jim Mlodgenski wrote: > On Thu, Sep 16, 2021 at 4:51 AM

Re: Want function to be called only once in query

2021-09-16 Thread Jim Mlodgenski
On Thu, Sep 16, 2021 at 4:51 AM Steve Pritchard wrote: > > I have a PL/pgSQL function that I want to call within a query, but the > function is fairly expensive to execute so I only want it executed once > within the query. However the planner seems to reorganize my query so that it > calls the

Want function to be called only once in query

2021-09-16 Thread Steve Pritchard
I have a PL/pgSQL function that I want to call within a query, but the function is fairly expensive to execute so I only want it executed once within the query. However the planner seems to reorganize my query so that it calls the function for every row. We were previously on Pg 9.6 and this wasn'