Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxj8v-0032s9-OT for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2023 07:26:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qxj8u-000xvj-6I for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2023 07:26:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxj8t-000xvb-TG for pgsql-hackers@lists.postgresql.org; Tue, 31 Oct 2023 07:26:27 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxj8q-003x7j-Ot for pgsql-hackers@postgresql.org; Tue, 31 Oct 2023 07:26:27 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id F34396102E; Tue, 31 Oct 2023 16:26:18 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 31 Oct 2023 16:26:18 +0900 From: torikoshia To: Kyotaro Horiguchi , bharath.rupireddyforpostgres@gmail.com Cc: pgsql-hackers@postgresql.org Subject: Re: Add new option 'all' to pg_stat_reset_shared() In-Reply-To: <20231031.115931.1009045759469844714.horikyota.ntt@gmail.com> References: <4291a55137ddda77cf7cc5f46e846daf@oss.nttdata.com> <20231030.171713.274529745163206826.horikyota.ntt@gmail.com> <20231031.115931.1009045759469844714.horikyota.ntt@gmail.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: torikoshia@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Oct 30, 2023 at 5:46 PM Bharath Rupireddy wrote: Thanks for the comments! > Isn't calling pg_stat_reset_shared() for all stats types helping you > out? Is there any problem with it? Can you be more specific about the > use-case? Yes, calling pg_stat_reset_shared() for all stats types can do what I wanted to do. But calling it with 6 different parameters seems tiresome and I thought it would be convenient to have a parameter to delete all cluster-wide statistics at once. I may be wrong, but I imagine that it's more common to want to delete all of the statistics for an entire cluster rather than just a portion of it. > IMV, I don't see any point for adding another pseudo (rather > non-existent) shared stats target which might confuse users - it's > easy to specify pg_stat_reset_shared('all'); to clear things out when > someone actually doesn't want to reset all - an accidental usage of > the 'all' option will reset all shared memory stats. I once considered changing the pg_stat_reset_shared() to delete all stats when called without parameters like pg_stat_statements_reset(), but gave it up since it can confuse users as you described. I was hoping that the need to specify 'all' would remind users that the target can be specified individually. -- Regards, -- Atsushi Torikoshi NTT DATA Group Corporation