Re: right way of using case-expressions in plpgsql functions - Mailing list pgsql-general

From Ron
Subject Re: right way of using case-expressions in plpgsql functions
Date
Msg-id 3ca87218-264c-421b-8e2b-59cd93f48bb3@gmail.com
Whole thread Raw
In response to right way of using case-expressions in plpgsql functions  (Victor Dobrovolsky <booby.stager@gmail.com>)
Responses Re: right way of using case-expressions in plpgsql functions  (Victor Dobrovolsky <booby.stager@gmail.com>)
List 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.

pgsql-general by date:

Previous
From: Victor Dobrovolsky
Date:
Subject: Re: right way of using case-expressions in plpgsql functions
Next
From: Tom Lane
Date:
Subject: Re: right way of using case-expressions in plpgsql functions