mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +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:
@ -58,6 +58,7 @@
|
||||
#include "storage/lmgr.h"
|
||||
#include "tcop/utility.h"
|
||||
#include "utils/acl.h"
|
||||
#include "utils/backend_status.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/partcache.h"
|
||||
@ -128,6 +129,14 @@ static void EvalPlanQualStart(EPQState *epqstate, Plan *planTree);
|
||||
void
|
||||
ExecutorStart(QueryDesc *queryDesc, int eflags)
|
||||
{
|
||||
/*
|
||||
* In some cases (e.g. an EXECUTE statement) a query execution will skip
|
||||
* parse analysis, which means that the queryid won't be reported. Note
|
||||
* that it's harmless to report the queryid multiple time, as the call will
|
||||
* be ignored if the top level queryid has already been reported.
|
||||
*/
|
||||
pgstat_report_queryid(queryDesc->plannedstmt->queryId, false);
|
||||
|
||||
if (ExecutorStart_hook)
|
||||
(*ExecutorStart_hook) (queryDesc, eflags);
|
||||
else
|
||||
|
Reference in New Issue
Block a user