Re: right way of using case-expressions in plpgsql functions

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: right way of using case-expressions in plpgsql functions
Date: 2023-10-15 21:14:00
Message-ID: 3ca87218-264c-421b-8e2b-59cd93f48bb3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/15/23 11:19, Victor Dobrovolsky wrote:
[snip]
> The documentation states that after some executions of such functions the
> plan should become generic.
> What is a generic plan for such a case and how would it work?

It's highly dependent on the query

When I see this happen (after we notice that a procedure starts taking a
/long/ time), the query planner flips from a custom plan to a generic plan
after about the fifth execution in a session of a function/procedure.

This will make it calculate the plan every time:
set plan_cache_mode = force_custom_plan;

--
Born in Arizona, moved to Babylonia.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2023-10-15 21:15:41 Re: right way of using case-expressions in plpgsql functions
Previous Message Victor Dobrovolsky 2023-10-15 20:24:27 Re: right way of using case-expressions in plpgsql functions