diff options
| author | Bruce Momjian <bruce@momjian.us> | 2021-04-07 14:03:56 -0400 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2021-04-07 14:04:06 -0400 |
| commit | 4f0b0966c866ae9f0e15d7cc73ccf7ce4e1af84b (patch) | |
| tree | f0848c536dcce037e64218f52bd9bc8f1cc3f0ae /src/include/utils/backend_status.h | |
| parent | ec7ffb8096e8eb90f4c9230f7ba9487f0abe1a9f (diff) | |
| download | postgresql-4f0b0966c866ae9f0e15d7cc73ccf7ce4e1af84b.tar.gz | |
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
Diffstat (limited to 'src/include/utils/backend_status.h')
| -rw-r--r-- | src/include/utils/backend_status.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/utils/backend_status.h b/src/include/utils/backend_status.h index 3fd7370d41..8e149b56ca 100644 --- a/src/include/utils/backend_status.h +++ b/src/include/utils/backend_status.h @@ -165,6 +165,9 @@ typedef struct PgBackendStatus ProgressCommandType st_progress_command; Oid st_progress_command_target; int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]; + + /* query identifier, optionally computed using post_parse_analyze_hook */ + uint64 st_queryid; } PgBackendStatus; @@ -294,12 +297,14 @@ extern void pgstat_clear_backend_activity_snapshot(void); /* Activity reporting functions */ extern void pgstat_report_activity(BackendState state, const char *cmd_str); +extern void pgstat_report_queryid(uint64 queryId, bool force); extern void pgstat_report_tempfile(size_t filesize); extern void pgstat_report_appname(const char *appname); extern void pgstat_report_xact_timestamp(TimestampTz tstamp); extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser); extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer, int buflen); +extern uint64 pgstat_get_my_queryid(void); /* ---------- |
