From: | Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Introduce squashing of constant lists in query jumbling |
Date: | 2025-03-18 17:58:30 |
Message-ID: | E1tubCw-0038AS-24@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Introduce squashing of constant lists in query jumbling
pg_stat_statements produces multiple entries for queries like
SELECT something FROM table WHERE col IN (1, 2, 3, ...)
depending on the number of parameters, because every element of
ArrayExpr is individually jumbled. Most of the time that's undesirable,
especially if the list becomes too large.
Fix this by introducing a new GUC query_id_squash_values which modifies
the node jumbling code to only consider the first and last element of a
list of constants, rather than each list element individually. This
affects both the query_id generated by query jumbling, as well as
pg_stat_statements query normalization so that it suppresses printing of
the individual elements of such a list.
The default value is off, meaning the previous behavior is maintained.
Author: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Reviewed-by: Sergey Dudoladov (mysterious, off-list)
Reviewed-by: David Geier <geidav(dot)pg(at)gmail(dot)com>
Reviewed-by: Robert Haas <robertmhaas(at)gmail(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reviewed-by: Sami Imseih <samimseih(at)gmail(dot)com>
Reviewed-by: Sutou Kouhei <kou(at)clear-code(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Reviewed-by: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Reviewed-by: Zhihong Yu <zyu(at)yugabyte(dot)com>
Tested-by: Yasuo Honda <yasuo(dot)honda(at)gmail(dot)com>
Tested-by: Sergei Kornilov <sk(at)zsrv(dot)org>
Tested-by: Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
Tested-by: Chengxi Sun <sunchengxi(at)highgo(dot)com>
Tested-by: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Discussion: https://postgr.es/m/CA+q6zcWtUbT_Sxj0V6HY6EZ89uv5wuG5aefpe_9n0Jr3VwntFg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/62d712ecfd940f60e68bde5b6972b6859937c412
Modified Files
--------------
contrib/pg_stat_statements/Makefile | 2 +-
contrib/pg_stat_statements/expected/squashing.out | 464 ++++++++++++++++++++++
contrib/pg_stat_statements/meson.build | 1 +
contrib/pg_stat_statements/pg_stat_statements.c | 76 +++-
contrib/pg_stat_statements/sql/squashing.sql | 180 +++++++++
doc/src/sgml/config.sgml | 30 ++
doc/src/sgml/pgstatstatements.sgml | 24 +-
src/backend/nodes/gen_node_support.pl | 19 +-
src/backend/nodes/queryjumblefuncs.c | 146 ++++++-
src/backend/postmaster/launch_backend.c | 3 +
src/backend/utils/misc/guc_tables.c | 10 +
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/nodes/nodes.h | 2 +
src/include/nodes/primnodes.h | 2 +-
src/include/nodes/queryjumble.h | 7 +
15 files changed, 945 insertions(+), 22 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2025-03-18 18:12:56 | pgsql: smgr: Make SMgrRelation initialization safer against errors |
Previous Message | Andres Freund | 2025-03-18 16:01:44 | pgsql: aio: Add io_method=worker |