Re: How to observe plan_cache_mode transition from custom to generic plan?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Richard Michael <rmichael(at)edgeofthenet(dot)org>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to observe plan_cache_mode transition from custom to generic plan?
Date: 2021-09-05 18:32:41
Message-ID: CAKFQuwYvmmhDjX+StTV8oDVMcPPQ0eTJ-pJep0VSB2RZyy+oNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday, September 5, 2021, Richard Michael <rmichael(at)edgeofthenet(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shubham Mittal 2021-09-05 18:51:00 Re: Query takes around 15 to 20 min over 20Lakh rows
Previous Message Mladen Gogala 2021-09-05 18:20:31 Re: How to observe plan_cache_mode transition from custom to generic plan?