postgresql/src/backend
Álvaro Herrera 62d712ecfd
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@gmail.com>
Reviewed-by: Sergey Dudoladov (mysterious, off-list)
Reviewed-by: David Geier <geidav.pg@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Sutou Kouhei <kou@clear-code.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Marcos Pegoraro <marcos@f10.com.br>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>
Tested-by: Yasuo Honda <yasuo.honda@gmail.com>
Tested-by: Sergei Kornilov <sk@zsrv.org>
Tested-by: Maciek Sakrejda <m.sakrejda@gmail.com>
Tested-by: Chengxi Sun <sunchengxi@highgo.com>
Tested-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Discussion: https://postgr.es/m/CA+q6zcWtUbT_Sxj0V6HY6EZ89uv5wuG5aefpe_9n0Jr3VwntFg@mail.gmail.com
2025-03-18 18:56:11 +01:00
..
access Fix typo. 2025-03-18 14:18:09 +05:30
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
bootstrap Remove unnecessary (char *) casts [mem] 2025-02-12 08:50:13 +01:00
catalog CREATE INDEX: do update index stats if autovacuum=off. 2025-03-10 17:49:27 -04:00
commands Add some new hooks so extensions can add details to EXPLAIN. 2025-03-18 09:28:01 -04:00
executor Make it possible for loadable modules to add EXPLAIN options. 2025-03-18 08:41:12 -04:00
foreign Update copyright for 2025 2025-01-01 11:21:55 -05:00
jit Add special case fast-paths for strict functions 2025-03-11 12:02:42 +01:00
lib Update copyright for 2025 2025-01-01 11:21:55 -05:00
libpq Modularize log_connections output 2025-03-12 11:35:21 -04:00
main Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodes Introduce squashing of constant lists in query jumbling 2025-03-18 18:56:11 +01:00
optimizer Remove table AM callback scan_bitmap_next_block 2025-03-15 10:37:46 -04:00
parser Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input. 2025-03-13 16:07:55 -04:00
partitioning Fix bug in cbc127917 to handle nested Append correctly 2025-02-25 09:24:42 +09:00
po Update copyright for 2025 2025-01-01 11:21:55 -05:00
port Update copyright for 2025 2025-01-01 11:21:55 -05:00
postmaster Introduce squashing of constant lists in query jumbling 2025-03-18 18:56:11 +01:00
regex Support PG_UNICODE_FAST locale in the builtin collation provider. 2025-01-17 15:56:30 -08:00
replication aio: Basic subsystem initialization 2025-03-17 18:51:33 -04:00
rewrite Fix incorrect handling of subquery pullup 2025-03-13 16:36:03 +09:00
snowball Update to latest Snowball sources. 2025-02-18 21:13:54 -05:00
statistics Address stats import review comments. 2025-03-05 23:07:25 -08:00
storage aio: Add io_method=worker 2025-03-18 11:54:01 -04:00
tcop aio: Infrastructure for io_method=worker 2025-03-18 11:54:01 -04:00
tsearch Clear errno before calling strtol() in spell.c. 2025-03-08 11:24:25 -05:00
utils Introduce squashing of constant lists in query jumbling 2025-03-18 18:56:11 +01:00
.gitignore
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls.mk Return yyparse() result not via global variable 2025-01-24 06:55:39 +01:00