diff options
author | Bruce Momjian <bruce@momjian.us> | 2021-04-07 13:06:47 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2021-04-07 13:06:56 -0400 |
commit | 5fd9dfa5f50e4906c35133a414ebec5b6d518493 (patch) | |
tree | 4bf0c6c9088eb8b053b029b9be787939d48d2e3b /doc/src | |
parent | a282ee68a070a8adc6e6d45e8e643769c587ecc3 (diff) |
Move pg_stat_statements query jumbling to core.
Add compute_query_id GUC to control whether a query identifier should be
computed by the core (off by default). It's thefore now possible to
disable core queryid computation and use pg_stat_statements with a
different algorithm to compute the query identifier by using a
third-party module.
To ensure that a single source of query identifier can be used and is
well defined, modules that calculate a query identifier should throw an
error if compute_query_id specified to compute a query id and if a query
idenfitier was already calculated.
Discussion: https://postgr.es/m/20210407125726.tkvjdbw76hxnpwfi@nol
Author: Julien Rouhaud
Reviewed-by: Alvaro Herrera, Nitin Jadhav, Zhihong Yu
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 25 | ||||
-rw-r--r-- | doc/src/sgml/pgstatstatements.sgml | 20 |
2 files changed, 44 insertions, 1 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index e51639d56c7..9d846cb7be0 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7622,6 +7622,31 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; <title>Statistics Monitoring</title> <variablelist> + <varlistentry id="guc-compute-query-id" xreflabel="compute_query_id"> + <term><varname>compute_query_id</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>compute_query_id</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Enables in-core computation of a query identifier. The <xref + linkend="pgstatstatements"/> extension requires a query identifier + to be computed. Note that an external module can alternatively + be used if the in-core query identifier computation method + isn't acceptable. In this case, in-core computation should + remain disabled. The default is <literal>off</literal>. + </para> + <note> + <para> + To ensure that a only one query identifier is calculated and + displayed, extensions that calculate query identifiers should + throw an error if a query identifier has already been computed. + </para> + </note> + </listitem> + </varlistentry> + <varlistentry> <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 464bf0e5aed..3ca292d71fb 100644 --- a/doc/src/sgml/pgstatstatements.sgml +++ b/doc/src/sgml/pgstatstatements.sgml @@ -21,6 +21,14 @@ </para> <para> + The module will not track statistics unless query + identifiers are calculated. This can be done by enabling <xref + linkend="guc-compute-query-id"/> or using a third-party module that + computes its own query identifiers. Note that all statistics tracked + by this module must be reset if the query identifier method is changed. + </para> + + <para> When <filename>pg_stat_statements</filename> is loaded, it tracks statistics across all databases of the server. To access and manipulate these statistics, the module provides views @@ -84,7 +92,7 @@ <structfield>queryid</structfield> <type>bigint</type> </para> <para> - Internal hash code, computed from the statement's parse tree + Hash code to identify identical normalized queries. </para></entry> </row> @@ -386,6 +394,16 @@ are compared strictly on the basis of their textual query strings, however. </para> + <note> + <para> + The following details about constant replacement and + <structfield>queryid</structfield> only applies when <xref + linkend="guc-compute-query-id"/> is enabled. If you use an external + module instead to compute <structfield>queryid</structfield>, you + should refer to its documentation for details. + </para> + </note> + <para> When a constant's value has been ignored for purposes of matching the query to other queries, the constant is replaced by a parameter symbol, such |