On 2021-01-13 09:47, yuzuko wrote:
> But we are also considering another option to solve this problem, which
> makes users to release cached SPI plans for referential integrity as well as
> plain cached plans with DISCARD ALL. To do that, we added a new
> function, RI_DropAllPreparedPlan() which deletes all plans from
> ri_query_cache and
> modified DISCARD ALL to execute that function.
I don't have a comment on the memory management issue, but I think the
solution of dropping all cached plans as part of DISCARD ALL seems a bit
too extreme of a solution. In the context of connection pooling,
getting a new session with pre-cached plans seems like a good thing, and
this change could potentially have a performance impact without a
practical way to opt out.