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 1tfUxy-002q53-7m for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Feb 2025 02:16:39 +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 1tfUxv-00AmBq-QM for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Feb 2025 02:16:35 +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 1tfUxu-00AmBi-LA for pgsql-hackers@lists.postgresql.org; Wed, 05 Feb 2025 02:16:35 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tfUxq-003LNg-33 for pgsql-hackers@lists.postgresql.org; Wed, 05 Feb 2025 02:16:34 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id AD85C1140140; Tue, 4 Feb 2025 21:16:29 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Tue, 04 Feb 2025 21:16:29 -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=1738721789; x=1738808189; bh=wB5SiByF3Q AQuVZhlMfaf0kbcvnqzO4oAEto9uSPIAE=; b=o376M6XxMjn/luEfuLvbDCSidn lUXJIW2PazVMTmaMlxTqjIu9zrZG8MRkMuTWFx6uOTuDxQgE14A6uqjZlwPTXZhe BoFeMU3ebK1fL6L5JRwlZ1aHsYG310Xu4mSbf0wb0R/eyd2l2ltJdPqe2jloYl4w 2xH2dKsdTiKNvela9XBH67PGfbpu36/GwCeDGQt1N+9hi/8Q/ipedu7jhYbaj4n4 HW3PuS/F8BtKbqzKDMNBbFY9iT73Pr9YGT5BGZwiNQil8z4XMDYsz90EiUY8XSoU dpqu98e1E6DXpyAIL5G5BF6aYSr4v1pZS/y0Ji+yUZ/OGRISNcVe9jSm5luQ== 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= 1738721789; x=1738808189; bh=wB5SiByF3QAQuVZhlMfaf0kbcvnqzO4oAEt o9uSPIAE=; b=npzcTKtDCQ4zOMgU9XyWY/eBjVCxMRRAADThlP9w1CNPwpgB98X gHB+Cy6owlCInjTbtGCO6sTC643V+ozEoCxMD6D3vO/kMdafI2bOHdBGKdllrDGN xB6PhqOGTzo72RoNW8JcMS6/xvrIiFrn9GYXYssGrqbqTKCp8AdaL657+bcsG7nX tDphHIZtHP/dmvQ9WUamI78Thqt2hy31Acjye7k5zEUFRr8dUHFeVXKaGjqfYpBi Dn1bFHc7VhIjbdWtfZRppKqFDZ+UFvhoIdesIF2MUyYY0w2X77jTkunBWAeeEBhV ijb9HkW1X+BQycsKpqi2Hd9aCr+lRe10u/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvddvtdcutefuodetggdotefrod 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; Tue, 4 Feb 2025 21:16:27 -0500 (EST) Date: Wed, 5 Feb 2025 11:16:15 +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="tTospGvxelLmqAOe" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --tTospGvxelLmqAOe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 04, 2025 at 08:49:41AM +0000, Bertrand Drouvot wrote: > I think that:=20 >=20 > wal_write (and wal_write_time) > wal_sync (and wal_sync_time) Right. We are not able to get this data from XLogWrite() and issue_xlog_fsync(), so there is no need to duplicate that anymore in your patch. > can be extracted from pg_stat_get_backend_io(), so there is no need to du= plicate > this information. The same comment could be done for pg_stat_wal and pg_s= tat_io > though, but pg_stat_wal already exists so removing fields has not the same > effect. >=20 > What are you thoughts about keeping in pg_stat_get_backend_wal() only the > 4 stats mentioned above? wal_buffers_full is incremented in AdvanceXLInsertBuffer(), part of PendingWalStats. wal_records, wal_fpi and wal_bytes are part of the instrumentation field. It looks to me that if you discard the wal_buffers_full part, the implementation of the data in the backend could just be tied to the fields coming from WalUsage. Actually, could it actually be useful to have wal_buffers_full be available in WalUsage, so as it would show up in EXPLAIN in a per-query basis with show_wal_usage()? Consolidating that would make what you are trying it a bit easier, because we would have the WalUsage and the pg_stat_io parts without any of the PendingWalStats part. And it is just a counter not that expensive to handle, like the data for records, fpis and bytes. This extra information could be useful to have in the context of an EXPLAIN. -- Michael --tTospGvxelLmqAOe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmeiye8ACgkQnvQgOdby QH2QlxAAoIQWm2cw65tmtDEsDf3RWaol7eg98VG4B6Osn4Rn966q62KpRl7Slici aPHECC36WusKwR/2Bfy9wUQexcwYFjLjAz9Mo22n/+5qY1bUD0p5jYnzA8Peqe/0 FJPEimX6zx2F7cL242TuQpsf1OnPoXOCiOfpUr7L+UQqwYaaPY/CrTwGnZvaCNnb Vcg/Avt25DG0U22NtJiGp2fMZeMqiLn09eTvH4XBGnivnHjcCpUI8gPNpP9+NMaY cgu4yn3z6Pbkgj1LBEyCyYUqMUvOCEN1j+IGCBtoa+vBMdbzWy2tjeo7aiaTSFf9 /IRaIK+CevbwCRHTrt6zDrqLaoOCKfxJdYE3OlXqQEP360Nmro376EJLIiFF8kij ef/EiTp/7iV3d6jQje/ILfQPmUkADsuwVs5nbIZ+L1iAQHL8/DK7QhlQDGf6Wt/D EzV6Hp0A+mbj5eqRuyzAVrDmwr+GJrOkOTOZw+C0ETISlRdaFmk/iXSBf3Q6o8Mg A62yLI9o7haTTH8YkinJlcjEcNb//oRO3k8s68bAgEnEwjAWdlbtlJg3sIkeDtjq gsIbs8gP/LpeQBbq3YzCUtzbgcxnoRa0tDd2unAY+vBFXFkpCu1sgaHT+JZBHb3d mZSKEqT6FC+hYjZTgNE+WRQP6ZXUrLES0kHnjcm5mQ4ew5xKd2A= =tek6 -----END PGP SIGNATURE----- --tTospGvxelLmqAOe--