1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

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
This commit is contained in:
Bruce Momjian
2021-04-07 13:06:47 -04:00
parent a282ee68a0
commit 5fd9dfa5f5
13 changed files with 995 additions and 785 deletions

View File

@@ -20,6 +20,14 @@
This means that a server restart is needed to add or remove the module.
</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
@@ -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