mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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
This commit is contained in:
@ -7004,6 +7004,15 @@ local0.* /var/log/postgresql
|
||||
session processes</entry>
|
||||
<entry>no</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%Q</literal></entry>
|
||||
<entry>query identifier of the current query. Query
|
||||
identifiers are not computed by default, so this field
|
||||
will be zero unless <xref linkend="guc-compute-query-id"/>
|
||||
parameter is enabled or a third-party module that computes
|
||||
query identifiers is configured.</entry>
|
||||
<entry>yes</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%%</literal></entry>
|
||||
<entry>Literal <literal>%</literal></entry>
|
||||
@ -7480,8 +7489,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
|
||||
<listitem>
|
||||
<para>
|
||||
Enables the collection of information on the currently
|
||||
executing command of each session, along with the time when
|
||||
that command began execution. This parameter is on by
|
||||
executing command of each session, along with its identifier and the
|
||||
time when that command began execution. This parameter is on by
|
||||
default. Note that even when enabled, this information is not
|
||||
visible to all users, only to superusers and the user owning
|
||||
the session being reported on, so it should not represent a
|
||||
@ -7630,12 +7639,16 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
|
||||
</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>.
|
||||
Enables in-core computation of a query identifier.
|
||||
Query identifiers can be displayed in the <link
|
||||
linkend="monitoring-pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
|
||||
view, using <command>EXPLAIN</command>, or emitted in the log if
|
||||
configured via the <xref linkend="guc-log-line-prefix"/> parameter.
|
||||
The <xref linkend="pgstatstatements"/> extension also requires a query
|
||||
identifier to be computed. Note that an external module can
|
||||
alternatively be used if the in-core query identifier computation
|
||||
specification isn't acceptable. In this case, in-core computation
|
||||
must be disabled. The default is <literal>off</literal>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -910,6 +910,22 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>queryid</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Identifier of this backend's most recent query. If
|
||||
<structfield>state</structfield> is <literal>active</literal> this
|
||||
field shows the identifier of the currently executing query. In
|
||||
all other states, it shows the identifier of last query that was
|
||||
executed. Query identifiers are not computed by default so this
|
||||
field will be null unless <xref linkend="guc-compute-query-id"/>
|
||||
parameter is enabled or a third-party module that computes query
|
||||
identifiers is configured.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>query</structfield> <type>text</type>
|
||||
|
@ -136,8 +136,10 @@ ROLLBACK;
|
||||
the output column list for each node in the plan tree, schema-qualify
|
||||
table and function names, always label variables in expressions with
|
||||
their range table alias, and always print the name of each trigger for
|
||||
which statistics are displayed. This parameter defaults to
|
||||
<literal>FALSE</literal>.
|
||||
which statistics are displayed. The query identifier will also be
|
||||
displayed if one has been computed, see <xref
|
||||
linkend="guc-compute-query-id"/> for more details. This parameter
|
||||
defaults to <literal>FALSE</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
Reference in New Issue
Block a user