From: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz>, Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com> |
Subject: | Re: track generic and custom plans in pg_stat_statements |
Date: | 2025-07-30 08:20:52 |
Message-ID: | 87249b23-c4c5-4c0b-88d3-efb13b8a04d1@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 30/7/2025 09:20, Michael Paquier wrote:
> On Tue, Jul 29, 2025 at 05:08:09PM -0500, Sami Imseih wrote:
>> The only comment I have is I think we need a NOT_SET
>> member, so it can simplify the life of extensions that have code
>> paths which may or may not have a PlannedStmt, such as
>> pgss_store.
>
> Okay by me for having a default that maps to something else than the
> rest.
>
> + PLAN_STMT_NOT_SET = 0, /* origin not yet set */
>
> The term "NOT_SET" makes me itch a little bit, even if there is an
> existing parallel with OverridingKind. Perhaps your proposal is OK,
> still how about "UNKNOWN" instead to use as term for the default?
+1 to "UNKNOWN".
There may be various sources for query plans. For instance, in the plan
freezing extension, I often bypass the standard planner completely by
using a plan created in another backend and serialised in shared memory.
Additionally, there is a concept of comparing hinted plans with those
generated freely after an upgrade, which would serve as an extra source
of plans.
One extra example - I sometimes build a 'referenced generic plan', using
incoming constants as a source for clause selectivity calculations,
building a generic plan, likewise SQL Server or Oracle implemented
generics. It seems like a 'hybrid' type of plan ;).
But generally, classification in the PlannedStmtOrigin structure seems a
little strange: a generic plan has a qualitative difference from any
custom one. And any other plan also will be generic or custom, doesn't
it? It is interesting information about the plan source, of course, but
for the sake of performance analysis, it would be profitable to
understand the type of plan. However, the last sentence may be a subject
for another thread.
--
regards, Andrei Lepikhov
From | Date | Subject | |
---|---|---|---|
Next Message | Álvaro Herrera | 2025-07-30 08:23:08 | Re: pg_dump --with-* options |
Previous Message | Michael Paquier | 2025-07-30 08:13:50 | Re: Broken ./configure checks for __cpuid() and __cpuidex() |