Re: Release SPI plans for referential integrity with DISCARD ALL

From: vignesh C <vignesh21(at)gmail(dot)com>
To: yuzuko <yuzukohosoya(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Release SPI plans for referential integrity with DISCARD ALL
Date: 2021-07-14 16:03:04
Message-ID: CALDaNm2SXncFzrKr2533D7tTmbb9UazJaOYGQTWR7d82KtZWRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 10, 2021 at 1:49 PM yuzuko <yuzukohosoya(at)gmail(dot)com> wrote:
>
> Hello,
>
> I thought about this suggestion again.
>
> Amit's patch suggested in the thread [1] can eliminate SPI plans from
> INSERT/UPDATE triggers, so our memory pressure issue would be solved.
> But as far as I can see that thread, Amit's patch doesn't cover DELETE case.
> It is not a common case, but there is a risk of pressing memory
> capacity extremely.
> Considering that, this suggestion might still have good value as Corey
> said before.
>
> I improved a patch according to Peter's following comment :
> > 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.
>
> In a new patch, I separated discarding SPI Plan caches for RI from DISCARD ALL
> and added a new option "RIPLANS" to DISCARD command to do that. Also a new
> function, ResetRIPlanCache() which clears SPI plan caches is called by
> DISCARD ALL
> or DISCARD RIPLANS. The amount of modification is small and this option can be
> removed instantly when it is no longer needed, so I think we can use
> this patch as
> a provisional solution.
>
> Any thoughts?

The patch does not apply on Head anymore, could you rebase and post a
patch. I'm changing the status to "Waiting for Author".

Regards,
Vignesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhihong Yu 2021-07-14 16:03:21 Re: Have I found an interval arithmetic bug?
Previous Message vignesh C 2021-07-14 16:01:38 Re: Reduce the number of special cases to build contrib modules on windows