Re: Potential "AIO / io workers" inter-worker locking issue in PG18? - Mailing list pgsql-bugs

From David Rowley
Subject Re: Potential "AIO / io workers" inter-worker locking issue in PG18?
Date
Msg-id CAApHDvr4o1QjDOD0avSB-3=943E7uJJ5EmRmJyGsD5m5aSA+3Q@mail.gmail.com
Whole thread Raw
In response to Re: Potential "AIO / io workers" inter-worker locking issue in PG18?  (Marco Boeringa <marco@boeringa.demon.nl>)
Responses Re: Potential "AIO / io workers" inter-worker locking issue in PG18?
List pgsql-bugs
On Tue, 21 Oct 2025 at 09:02, Marco Boeringa <marco@boeringa.demon.nl> wrote:
> https://stackoverflow.com/questions/20718499/does-postgresql-cache-function-calls#comment31095072_20718499
>
> And in relation to that post and thread, and the suggestion of WITH /
> CTE clause, would that be a suitable substitute and avoid the recalling
> of the functions? I assume with the MATERIALIZED option, it should, that
> is what the MATERIALIZED option is for, isn't it?

That article states "this function is invoked multiple times with the
same parameter", so doesn't sound very applicable for your case since
your function parameter changes with every row.

I don't see how WITH MATERIALIZED could help you here as that's not a
parameterized cache. I suppose we could adjust the planner to consider
something similar to Memoize for caching results for expensive stable
functions. We'd have to put a lot of trust into n_distinct estimates
and the function(s) COST setting, however.

I suspect you're trying to optimise for something that's not an actual problem.

David



pgsql-bugs by date:

Previous
From: Marco Boeringa
Date:
Subject: Re: Potential "AIO / io workers" inter-worker locking issue in PG18?
Next
From: Marco Boeringa
Date:
Subject: Re: Potential "AIO / io workers" inter-worker locking issue in PG18?