Make use of in-core query id added by commit 5fd9dfa5f5
Use the in-core query id computation for pg_stat_activity,
log_line_prefix, and EXPLAIN VERBOSE.
Similar to other fields in pg_stat_activity, only the queryid from the
top level statements are exposed, and if the backends status isn't
active then the queryid from the last executed statements is displayed.
Add a %Q placeholder to include the queryid in log_line_prefix, which
will also only expose top level statements.
For EXPLAIN VERBOSE, if a query identifier has been computed, either by
enabling compute_query_id or using a third-party module, display it.
Bump catalog version.
Discussion: https://postgr.es/m/20210407125726.tkvjdbw76hxnpwfi@nol
Author: Julien Rouhaud
Reviewed-by: Alvaro Herrera, Nitin Jadhav, Zhihong Yu
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4f0b0966c866ae9f0e15d7cc73ccf7ce4e1af84b
Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 112 ++++++++++--------------
doc/src/sgml/config.sgml | 29 ++++--
doc/src/sgml/monitoring.sgml | 16 ++++
doc/src/sgml/ref/explain.sgml | 6 +-
src/backend/catalog/system_views.sql | 1 +
src/backend/commands/explain.c | 18 ++++
src/backend/executor/execMain.c | 9 ++
src/backend/executor/execParallel.c | 5 +-
src/backend/parser/analyze.c | 5 ++
src/backend/tcop/postgres.c | 5 ++
src/backend/utils/activity/backend_status.c | 68 ++++++++++++++
src/backend/utils/adt/pgstatfuncs.c | 7 +-
src/backend/utils/error/elog.c | 8 ++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/backend/utils/misc/queryjumble.c | 27 +++---
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 6 +-
src/include/utils/backend_status.h | 5 ++
src/test/regress/expected/explain.out | 11 ++-
src/test/regress/expected/rules.out | 9 +-
src/test/regress/sql/explain.sql | 5 +-
21 files changed, 250 insertions(+), 105 deletions(-)