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 1tasDm-005xNB-I7 for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 08:05:51 +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 1tasDl-00C0Da-MZ for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 08:05:49 +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 1tasDk-00C0DS-HH for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 08:05:49 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tasDh-0013Lk-24 for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 08:05:48 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 8901F1140149; Thu, 23 Jan 2025 03:05:44 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Thu, 23 Jan 2025 03:05:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1737619544; x=1737705944; bh=iBE92drGck KbSqkIR14wcwWRiQsSPW+IH/eaOaawRHk=; b=bpz2vA/T5bnBLP527dc7wBOUN/ 1V4k3uSdniiICpMB1IFs4mREkgaNq40w83FTjGKdnPDa4nQwHdeeNA/JsZKbZle3 KmAztqD0RzsuoVigJ06yieU3gn6H9CyL4bw7ynCVEtIzDKERBCk/eHL6fcZnj2XU ONK8MIi3Uu4MwFusXVhgkain0xY4DgEq/2NJD4zG4bQMZB6ud38+ETRl+y3QTym2 b/rYssoXvHFFxF2LZqk5ECEz2pZD1/HGEHG5yvvxW5dbCKxvT/s9Ot4X5x41fGjm k7f64kZuaYUGfvJX+qh55bVYVJSX5rt0XLBeW8uvR0BDr9/2qyn7Vms9GoKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1737619544; x=1737705944; bh=iBE92drGckKbSqkIR14wcwWRiQsSPW+IH/e aOaawRHk=; b=ojNfjWL/A0vHgd1v29wvSRmgz6dmXX5JnmCQ1sH46AZJvdiV48x 9bomWCntni0C4SYDgvftxHPZ1G4ylOnkwiNYCdmqRpAVNL9/eNfskFhloXsAYILn vZv8pacORshaxfpeFEvCdTNEkK1wiAWzklMS5MfWwO62ig2tkGOoW4Pax/EYbJPN mbHvATESj6kWrPWsxPm9SM2oMuA+RR5y13z1L/vGYRAzl4b78/DViCzwtEJ4TJfQ Fow3ESRs6p91LnrniC5FtQLJbHsW3LbUCGhsKKtCG+REYtKwyxOzsWYyIqpbUMSQ LCBVu/gCTsxCezIJ1Qpb4iBpbm2afGt9Smw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffk fhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrh cuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeet leeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghl sehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegsvghrthhrrghnuggurhhouhhvohhtrdhpghesghhmrghilhdr tghomhdprhgtphhtthhopegrnhgurhgvshesrghnrghrrgiivghlrdguvgdprhgtphhtth hopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhr gh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Jan 2025 03:05:42 -0500 (EST) Date: Thu, 23 Jan 2025 17:05:30 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: Andres Freund , pgsql-hackers@lists.postgresql.org Subject: Re: per backend WAL statistics Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FPDGd6js2iQrp5iY" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --FPDGd6js2iQrp5iY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 21, 2025 at 07:19:55AM +0000, Bertrand Drouvot wrote: > PFA v6 that now relies on the new PendingBackendStats variable introduced= in > 4feba03d8b9. >=20 > Remark: I moved PendingBackendStats back to pgstat.h because I think that= the > "simple" pending stats increment that we are adding in xlog.c are not wor= th > an extra function call overhead (while it made more sense for the more co= mplex IO > stats handling). So PendingBackendStats is now visible to the outside wor= ld like > PendingWalStats and friends. You are re-doing here a pattern I was trying to avoid so as we don't copy-paste more checks based on pgstat_tracks_backend_bktype more than necessary. I am wondering if we should think harder about the interface used to register WAL stats, and make it more consistent with the way pg_stat_io is handled, avoiding the hardcoded attribute numbers if we have an enum to control which field to update in some input routine. As we have only five counters in PgStat_PendingWalStats, the result you have is not that invasive, true. Are you sure that the interactions between pgWalUsage, prevWalUsage and prevBackendWalUsage are correct? As far I got it from a code read, prevWalUsage, prevBackendWalUsage and their local trackings in pgstat_backend.c and pgstat_wal.c rely on instrument.c as the primary source, as pgWalUsage can never be reset. Is that right? -- Michael --FPDGd6js2iQrp5iY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmeR+EoACgkQnvQgOdby QH3aUQ//f8PlW+fq60OlZDa1AmlLZpZjFo/COdj7S2u5n9zUeN42SDwPvUzyvCr2 hsyvF438BbNFSTU6F2RkUavIOpb/6nszDm8kV5o3sK7RqM5kbOZvvCSvndGJ2QMo 1avAqRHEKd+P7dxo7nGO+dMGXrqk6qXq5tCEOS/FSSeb9/H2h3BLeSMw8a6I6qDp 6vMOlmURBp+MNNIYk3Nc21U5e9T941aKt7/R2S6uBUYlAsZBtgBj9Dnglzu60BRd F4lZkWPQ0E2XZakk4jIvB3axfobvFYO1rV4+3hffJ2dA8I1Mca1Lo+dY52XsqWwD 2KcJjSSe6DDHOgEUy8+uAVAuJRAvFT+BjkTfZ3470DxruTuTUCcC0N9wsqusCU1G lih15SBTN73rltHGjSkmv7oxGPGvjVWyCEbpygw/sZLvZwOnPyjzHrEhGq5dEIZg 0o3SZSW1cxcdUKC+iP9bwqRLY4q5U0txELXqsbZIq/JDJyPzauPqtZKgGr2fKwSS LAfAiSEoePYbhwJQDkwbpotcVjY/np8hI1lzgKMuDBnNdYTlEjbOKr0YpkU9aTW0 CNVkHMxVj/IIS2hpXHGR98JlrLLhFuW0dC0EKdHbkJk1+yFyuFvMVgel+IPUcT7/ aEsK1F0R1czNq2CfPo352TuwLcB85DkONzGS0zUW3vrmMFzTiAE= =Xqhi -----END PGP SIGNATURE----- --FPDGd6js2iQrp5iY--