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.96) (envelope-from ) id 1vmoSr-00GX87-1M for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 07:35:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vmoSp-00CjXe-1p for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 07:35:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vmoPb-00CfEr-2a for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 07:31:57 +0000 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vmoPa-000000009bL-2OTd for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 07:31:55 +0000 Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id 0B2FC1D00078; Mon, 2 Feb 2026 02:31:54 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Mon, 02 Feb 2026 02:31:54 -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=1770017513; x=1770103913; bh=iFVvrzwgmB fsJDxUX50D1Z5S2Ph86kthndeRyQ3P1yc=; b=Q8LE1QZL4XfNr6FHA0wbO9RsfU HlyZiNsnQJyadOT5pkq55eoaLTLUHF+iSJbysG5Zjr5FbHqP2W9LJXubo3Cadprk Aj1K8FEtqu1ldGHqUbXhgXe3M7w01Y1KqkstPmeEFxDDfwHXdb5iXVC/ue+lSw/I e/k4bjUhsr1DqZSkoukAOqkyhTIsev0DbAWd7GDLAdFWESDBgq4xZsJUNJDHJk8n kF3hEJFvlPf+oYSFdlTxjSL0O57SydactMOkKbR74ALSuoWtwrV4kMXv7iOowzlj WpngDJ5rNhVWgPvGwEDc9BT54rn3IE95MGV6w6Q1DXCuwEuXL1DmVVZ/xWRA== 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= 1770017513; x=1770103913; bh=iFVvrzwgmBfsJDxUX50D1Z5S2Ph86kthnde RyQ3P1yc=; b=Wf3s/Xi1tQQa+PbbbYqpGCh9q4JrTEJKaG/bP6O4GycUbrzn1ho Z905RdSOEBMCu2RYoqk5+SMhnqKlmMr1oaLFhyCG6QOaoZuekhNOrUzimQjNUnVF 4ZmMfdh5aWKMKlBe1CkY2CR1PiotNSKV62tF3Ln7Cc17vGdByIXaAppCOaZN1U/O QGYVwQe8KQaQH0WK9bOq5kLstnpVzGA1Zg/WLy4cz+eHuHhpEknORQD1tl6Ly4p1 NWpE97uPf/feyL9Foj9jYlINS4s0fEGpzZVfEAZsdZ92eDuJXmpS23vKPYQidxDI 8wr9NqP4TpkOUQOt5IGc5jOAfyfXcpSSjRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeejtdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshgrmh himhhsvghihhesghhmrghilhdrtghomhdprhgtphhtthhopegsvghrthhrrghnuggurhho uhhvohhtrdhpghesghhmrghilhdrtghomhdprhgtphhtthhopehmrghsrghordhfuhhjih hisehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhi shhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepiihsohhlthdrphgrrh hrrghgihesphgvrhgtohhnrgdrtghomh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 02:31:52 -0500 (EST) Date: Mon, 2 Feb 2026 16:31:48 +0900 From: Michael Paquier To: Sami Imseih Cc: Bertrand Drouvot , Fujii Masao , pgsql-hackers@lists.postgresql.org, Zsolt Parragi Subject: Re: Flush some statistics within running transactions Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Hs9NkvGvEdr76oRJ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Hs9NkvGvEdr76oRJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 31, 2026 at 11:16:03AM -0600, Sami Imseih wrote: > Also, the anytime flush callback does not need to check if there are > any variable-numbered stats to flush. This will not be needed as > it is in v4-0004 >=20 > ``` > + /* > + * Check if there are any non-transactional stats to flush. Avoid > + * unnecessarily locking the entry if nothing accumulated. > + */ > + if (!(lstats->counts.numscans > 0 || > + lstats->counts.tuples_returned > 0 || > + lstats->counts.tuples_fetched > 0 || > + lstats->counts.blocks_fetched > 0 || > + lstats->counts.blocks_hit > 0)) > + return true; > ``` I think that this kind of check may finish by being expensive. Reducing the number of fields to check for a non-flushing state, if required, would be preferrable. -- Michael --Hs9NkvGvEdr76oRJ Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmmAUuQACgkQnvQgOdby QH3QUhAAiWINa54xFVpmILTS+uCNmhIE6QPB7DvovzdtHH41+Smze5Jh4nfPLfG9 ODTvp6kCUp2JjcE18oAJFvA+wUzPaOjiNa1Bp8CQceC+tAY/xPguQzpHsKxZfw5K UV0mUZCUqLropJlPEeQ99zBFFlc/6ET/1py1oKw4grKtdpO6ErPmxBmgzzA0zjP8 JAV1qVA+tke1t7ES5zVxC0XKk38so/Qo1I7xRgK3Ncd2dYzz4HhBFelzTl5sdNH3 Nuv3+k/ngnFM2kEc44qUkPkGxrTlYFwV/dd4WvPehQAdwpBMwiK7IfVfKYJTBeiI F9s2yTo6YbuqxKNcNLk8TAMcXHDPlghxcoHNW2PQ7aMHWQfELpdbdJzj4v6MoLdN u2GD2ObaFD+0lkm442ZkK+Ps5XCrYxJy+InEiPEiosnkCqo92D62YJGHcj/ykYFO OV+pOXQD6UdBe8SRIi1949MJUhE2CBdcFpKyoYAppx8EI66nblSJ2BOcQLoJLcgz x7fLgIRFXYj10ll0mDkVn3s/ZiMkAgS8ZCXP7akKlAhZ3D68RMbTH00+ujMsMjTP az88H06bQtru/TQkEpYdJ076Q7Vy9KbgZsgqFp4m2DB6z/Oc5Xf3oms0XpZwTgdO NuopSr+uBvDIT0tXCc3sthb/MY3vsV58Kg0mDRVMu82b7GSLwvM= =ITP8 -----END PGP SIGNATURE----- --Hs9NkvGvEdr76oRJ--