pgsql: pg_stat_statements: Add counters for generic and custom plans

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_stat_statements: Add counters for generic and custom plans
Date: 2025-07-31 02:39:46
Message-ID: E1uhJCs-001agz-08@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_stat_statements: Add counters for generic and custom plans

This patch adds two new counters to pg_stat_statements:
- generic_plan_calls
- custom_plan_calls

These counters track how many times a prepared statement was executed
using a generic or custom plan, respectively, providing a global
equivalent at query level, for top and non-top levels, of
pg_prepared_statements whose data is restricted to a single session.

This commit builds upon e125e360020a. The module is bumped to version
1.13. PGSS_FILE_HEADER is bumped as well, something that the latest
patches touching the on-disk format of the PGSS file did not actually
bother with since 2022..

Author: Sami Imseih <samimseih(at)gmail(dot)com>
Reviewed-by: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
Reviewed-by: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
Discussion: https://postgr.es/m/CAA5RZ0uFw8Y9GCFvafhC=OA8NnMqVZyzXPfv_EePOt+iv1T-qQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3357471cf9f5e470dfed0c7919bcf31c7efaf2b9

Modified Files
--------------
contrib/pg_stat_statements/Makefile | 3 +-
.../pg_stat_statements/expected/oldextversions.out | 67 ++++++
contrib/pg_stat_statements/expected/plancache.out | 224 +++++++++++++++++++++
contrib/pg_stat_statements/meson.build | 2 +
.../pg_stat_statements--1.12--1.13.sql | 78 +++++++
contrib/pg_stat_statements/pg_stat_statements.c | 53 ++++-
.../pg_stat_statements/pg_stat_statements.control | 2 +-
contrib/pg_stat_statements/sql/oldextversions.sql | 5 +
contrib/pg_stat_statements/sql/plancache.sql | 94 +++++++++
doc/src/sgml/pgstatstatements.sgml | 18 ++
10 files changed, 536 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2025-07-31 13:43:10 pgsql: Sort dump objects independent of OIDs, for the 7 holdout object
Previous Message Michael Paquier 2025-07-31 01:06:48 pgsql: Rename CachedPlanType to PlannedStmtOrigin for PlannedStmt