public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
Subject: [PATCH v5 3/4] Don't include other backend's stats in the snapshot
Date: Thu, 7 Nov 2024 12:10:37 +0000

When stats_fetch_consistency is set to 'snapshot', don't include other backend's
stats in the snapshot. There is no use case, so save memory usage.
---
 src/backend/utils/activity/pgstat.c | 4 ++++
 1 file changed, 4 insertions(+)
 100.0% src/backend/utils/activity/

diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index d051db5c10..4982dec8a9 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -1181,6 +1181,10 @@ pgstat_build_snapshot(void)
 			!kind_info->accessed_across_databases)
 			continue;
 
+		/* there is no need to include other backend's stats */
+		if (kind == PGSTAT_KIND_PER_BACKEND && p->key.objid != MyProcNumber)
+			continue;
+
 		if (p->dropped)
 			continue;
 
-- 
2.34.1


--xszoq7AUxWDP9Wxf
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="v5-0004-Add-pg_stat_get_backend_io.patch"



view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v5 3/4] Don't include other backend's stats in the snapshot
  In-Reply-To: <no-message-id-1837617@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox