diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 30 | ||||
-rw-r--r-- | doc/src/sgml/pgstatstatements.sgml | 24 |
2 files changed, 51 insertions, 3 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index cd889142773..9e9c02cde83 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -8701,6 +8701,36 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; </listitem> </varlistentry> + <varlistentry id="guc-query-id-squash-values" xreflabel="query_id_squash_values"> + <term><varname>query_id_squash_values</varname> (<type>bool</type>) + <indexterm> + <primary><varname>query_id_squash_values</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Specifies how a list of constants (e.g., for an <literal>IN</literal> + clause) contributes to the query identifier computation. + Normally, every element of such a list contributes to the query + identifier separately, which means that two queries that only differ + in the number of elements in such a list would get different query + identifiers. + If this parameter is on, a list of constants will not contribute + to the query identifier. This means that two queries whose only + difference is the number of constants in such a list are going to get the + same query identifier. + </para> + <para> + Only constants are affected; bind parameters do not benefit from this + functionality. The default value is <literal>off</literal>. + </para> + <para> + This parameter also affects how <xref linkend="pgstatstatements"/> + generates normalized query texts. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-log-statement-stats"> <term><varname>log_statement_stats</varname> (<type>boolean</type>) <indexterm> diff --git a/doc/src/sgml/pgstatstatements.sgml b/doc/src/sgml/pgstatstatements.sgml index e2ac1c2d501..f4e384e95ae 100644 --- a/doc/src/sgml/pgstatstatements.sgml +++ b/doc/src/sgml/pgstatstatements.sgml @@ -630,9 +630,27 @@ <para> In some cases, queries with visibly different texts might get merged into a - single <structname>pg_stat_statements</structname> entry. Normally this will happen - only for semantically equivalent queries, but there is a small chance of - hash collisions causing unrelated queries to be merged into one entry. + single <structname>pg_stat_statements</structname> entry; as explained above, + this is expected to happen for semantically equivalent queries. + In addition, if <varname>query_id_squash_values</varname> is enabled + and the only difference between queries is the number of elements in a list + of constants, the list will get squashed down to a single element but shown + with a commented-out list indicator: + +<screen> +=# SET query_id_squash_values = on; +=# SELECT pg_stat_statements_reset(); +=# SELECT * FROM test WHERE a IN (1, 2, 3, 4, 5, 6, 7); +=# SELECT * FROM test WHERE a IN (1, 2, 3, 4, 5, 6, 7, 8); +=# SELECT query, calls FROM pg_stat_statements + WHERE query LIKE 'SELECT%'; +-[ RECORD 1 ]------------------------------ +query | SELECT * FROM test WHERE a IN ($1 /*, ... */) +calls | 2 +</screen> + + In addition to these cases, there is a small chance of hash collisions + causing unrelated queries to be merged into one entry. (This cannot happen for queries belonging to different users or databases, however.) </para> |