diff options
author | Michael Paquier <michael@paquier.xyz> | 2023-03-01 10:47:01 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2023-03-01 10:47:01 +0900 |
commit | 6da67a0c111a29e876b7172d081c7d152d23ea3d (patch) | |
tree | b72e452dbc1ead71a2cd8f6c89622ccd401ad9e6 | |
parent | 6a88a058614bc921d6cab1cc50330ddee283c810 (diff) | |
download | postgresql-6da67a0c111a29e876b7172d081c7d152d23ea3d.tar.gz postgresql-6da67a0c111a29e876b7172d081c7d152d23ea3d.zip |
doc: Mention de-normalization of deallocated entries in pg_stat_statements
The current implementation of query normalization in pg_stat_statements
is optimistic. If an entry is deallocated between the post-analyze hook
and the planner and/or execution hook, it can be possible to find query
strings with literal constant values (like "SELECT 1, 2") rather than
their normalized flavor (like "SELECT $1, $2").
This commit adds in the documentation a paragraph about this limitation,
and that this risk can be reduced by increasing pg_stat_statements.max,
particularly if pg_stat_statements_info reports a high number of
deallocations.
Author: Sami Imseih
Discussion: https://postgr.es/m/9CFF3512-355B-4676-8CCC-6CF622F4DC1A@amazon.com
-rw-r--r-- | doc/src/sgml/pgstatstatements.sgml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/src/sgml/pgstatstatements.sgml b/doc/src/sgml/pgstatstatements.sgml index 0b40e1eea3a..b1214ee6453 100644 --- a/doc/src/sgml/pgstatstatements.sgml +++ b/doc/src/sgml/pgstatstatements.sgml @@ -517,6 +517,16 @@ </para> <para> + Queries on which normalization can be applied may be observed with constant + values in <structname>pg_stat_statements</structname>, especially when there + is a high rate of entry deallocations. To reduce the likelihood of this + happening, consider increasing <varname>pg_stat_statements.max</varname>. + The <structname>pg_stat_statements_info</structname> view, discussed below + in <xref linkend="pgstatstatements-pg-stat-statements-info"/>, + provides statistics about entry deallocations. + </para> + + <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 |