Re: DISCARD ALL does not force re-planning of plpgsql functions/procedures

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DISCARD ALL does not force re-planning of plpgsql functions/procedures
Date: 2024-05-26 17:39:30
Message-ID: 3206.1716745170@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jelte Fennema-Nio <postgres(at)jeltef(dot)nl> writes:
> I got a report on the PgBouncer repo[1] that running DISCARD ALL was
> not sufficient between connection handoffs to force replanning of
> stored procedures. Turns out that while DISCARD AL and DISCARD PLAN
> reset the plan cache they do not reset the num_custom_plans fields of
> the existing PlanSources. So while the generic plan is re-planned
> after DISCARD ALL, the decision on whether to choose it or not won't
> be changed.

Hm, should it be? That's hard-won knowledge, and I'm not sure there
is a good reason to believe it's no longer applicable.

Note that any change in behavior there would affect prepared
statements in general, not only plpgsql.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2024-05-26 19:26:51 Re: DISCARD ALL does not force re-planning of plpgsql functions/procedures
Previous Message Jelte Fennema-Nio 2024-05-26 17:15:54 DISCARD ALL does not force re-planning of plpgsql functions/procedures