Re: How to observe plan_cache_mode transition from custom to generic plan? - Mailing list pgsql-general

From David G. Johnston
Subject Re: How to observe plan_cache_mode transition from custom to generic plan?
Date
Msg-id CAKFQuwYvmmhDjX+StTV8oDVMcPPQ0eTJ-pJep0VSB2RZyy+oNw@mail.gmail.com
Whole thread Raw
In response to How to observe plan_cache_mode transition from custom to generic plan?  (Richard Michael <rmichael@edgeofthenet.org>)
Responses Re: How to observe plan_cache_mode transition from custom to generic plan?  (Richard Michael <rmichael@edgeofthenet.org>)
List pgsql-general
On Sunday, September 5, 2021, Richard Michael <rmichael@edgeofthenet.org> wrote:

Based on the documentation, I expected the first planned query text to
be: `SELECT 10 AS data`, since it should be a custom plan with
substituted values.  However, the query text always contains a parameter
symbol: `SELECT $1 AS data`.


A query plan is not the same as the query text.  While the executed plan can be generic or custom the query text is constant.

If you want to see the difference between a generic and a custom plan you need to comprise a query that would actually have different custom and generic plans.  Queries that don’t involve tables, indexes, or joins don’t have any choices to make with respect to how they are executed.

David J.

pgsql-general by date:

Previous
From: Mladen Gogala
Date:
Subject: Re: How to observe plan_cache_mode transition from custom to generic plan?
Next
From: Shubham Mittal
Date:
Subject: Re: Query takes around 15 to 20 min over 20Lakh rows