From 34e14104d7222e97b2b24d8591718ff4ab6dfc07 Mon Sep 17 00:00:00 2001 From: Ibrar Ahmed Date: Mon, 21 Mar 2022 17:53:59 +0500 Subject: [PATCH] PG-338: Calls count is not correct in PG-13.; PG-331: Default values for better presentation in PMM (#191) * PG-338: Calls count is not correct in PG-13. * PG-331: Defaults values for better presentation in PMM. * Update pg_stat_monitor.c Co-authored-by: Lenz Grimmer Co-authored-by: Hamid Akhtar Co-authored-by: Ibrar Ahmad --- guc.c | 4 ++-- pg_stat_monitor.c | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/guc.c b/guc.c index 66120a9..219f7b5 100644 --- a/guc.c +++ b/guc.c @@ -51,7 +51,7 @@ init_guc(void) conf[i] = (GucVariable) { .guc_name = "pg_stat_monitor.pgsm_query_max_len", .guc_desc = "Sets the maximum length of query.", - .guc_default = 1024, + .guc_default = 2048, .guc_min = 1024, .guc_max = INT_MAX, .guc_unit = 0, @@ -184,7 +184,7 @@ init_guc(void) .guc_name = "pg_stat_monitor.pgsm_track", .guc_desc = "Selects which statements are tracked by pg_stat_monitor.", .n_options = 3, - .guc_default = PGSM_TRACK_ALL, + .guc_default = PGSM_TRACK_TOP, .guc_min = PSGM_TRACK_NONE, .guc_max = PGSM_TRACK_ALL, .guc_restart = false, diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 9a14a46..6978cd1 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -1791,7 +1791,12 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo, tmp = e->counters; SpinLockRelease(&e->mutex); } - if (!IsBucketValid(bucketid)) + + /* In case that query plan is enabled, there is no need to show 0 planid query */ + if (tmp.info.cmd_type == CMD_SELECT && PGSM_QUERY_PLAN && planid == 0) + continue; + + if (!IsBucketValid(bucketid)) { if (tmp.state == PGSS_FINISHED) continue;