From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Track identical top vs nested queries independently in pg_stat_s |
Date: | 2021-04-08 08:30:51 |
Message-ID: | E1lUQ3v-0006sP-Io@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Track identical top vs nested queries independently in pg_stat_statements
Changing pg_stat_statements.track between 'all' and 'top' would control
if pg_stat_statements tracked just top level statements or also
statements inside functions, but when tracking all it would not
differentiate between the two. Being table to differentiate this is
useful both to track where the actual query is coming from, and to see
if there are differences in executions between the two.
To do this, add a boolean to the hash key indicating if the statement
was top level or not.
Experience from the pg_stat_kcache module shows that in at least some
"reasonable worloads" only <5% of the queries show up both top level and
nested. Based on this, admittedly small, dataset, this patch does not
try to de-duplicate those query *texts*, and will just store one copy
for the top level and one for the nested.
Author: Julien Rohaud
Reviewed-By: Magnus Hagander, Masahiro Ikeda
Discussion: https://postgr.es/m/20201202040516.GA43757@nol
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6b4d23feef6e334fb85af077f2857f62ab781848
Modified Files
--------------
contrib/pg_stat_statements/Makefile | 3 +-
.../expected/pg_stat_statements.out | 40 +++++++++++++++
.../pg_stat_statements--1.9--1.10.sql | 57 ++++++++++++++++++++++
contrib/pg_stat_statements/pg_stat_statements.c | 50 ++++++++++++++++---
.../pg_stat_statements/pg_stat_statements.control | 2 +-
.../pg_stat_statements/sql/pg_stat_statements.sql | 21 ++++++++
doc/src/sgml/pgstatstatements.sgml | 9 ++++
7 files changed, 173 insertions(+), 9 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2021-04-08 08:57:35 | pgsql: doc: Prefer explicit JOIN syntax over old implicit syntax in tut |
Previous Message | Julien Rouhaud | 2021-04-08 06:49:19 | Re: pgsql: Move pg_stat_statements query jumbling to core. |