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 1wV02v-001bVB-0p for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 04:51:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wV02u-004uOW-0Z for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 04:51:08 +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 1wV02t-004uON-2s for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 04:51:07 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wV02s-000000011CC-0VBM for pgsql-hackers@postgresql.org; Thu, 04 Jun 2026 04:51:07 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 0ADDF1D0017C; Thu, 4 Jun 2026 00:51:05 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Thu, 04 Jun 2026 00:51:05 -0400 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=fm1; t=1780548664; x=1780635064; bh=Q+LdV0rAhc 4+7S6aXfZeyPqQ+VVD9ypKEZPwDybiJ8c=; b=0nStKfFFMFnQ5ty0WqsVVKyGo/ IzJa3PvnD4ZMbyH/nzgSOCdUepXS3ZpoO5wxjcEPET2wLbHUs4ViMZLG1ZCjsCP0 zc76+hlLDnMp0eeW97iJq2eaitBOoK7o7Ic4sBZGlXHbGEDymAcWbZP2fiBYPKLl 89Yh8j/t2X285Hz+gZnjwF8CyGLGrdq/6eEaD5gNWzanQa6V9aXlsuAcZ/hAbnxk Vt02O+pJGh/lQllJRQzDR5UQ3yq+9DQ/YghxPjWCW2NIlhR1Wx2cwvm7HPyNJnaV MV31/1z82cv0NFoPfv5u9luTe782P1n7oEpdFl1JoJkpRIu+9rA1IPPONcGg== 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=fm1; t= 1780548664; x=1780635064; bh=Q+LdV0rAhc4+7S6aXfZeyPqQ+VVD9ypKEZP wDybiJ8c=; b=VePygLhALYFcf4N6Itcq7ycYF4OVmUIbKJaUjJ5tHe85tX8vnzC KBh2OOgAIdpB2VVRDbchNWioET47OiVN6nvk6+XPB+1uZ5GKCHE8/Q9d6XBH9QFT 7G2c+dxQB4Pul+ekldBnbJOVTh+UBiqu56bTt9y6T4p5GZPa84JsNQk/VoxsXeV8 9P0/oBdBK86hc/gzCxdV+QipuFhrVREThlPnsf7JFFsuKLn6ifjfQY+7u8oW8xxy B5QegJUxgv7XgeibMSEyFBb6+aIGNRaD2Dx38rBOB9iVbiWAFWGFJSR1rY6FEODS 0Udnevimj2RrfiBeprFzmFtWTBiL1/rpPXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEQjM674fyffH8DzF1xwDcULorYeqG2eKrJUT5rtuOUsdecef4uXU7UzfOG9wKf6X y6EATh1tj2M5jSWh5xphsL6Zydm3o+wi/SGF+siQqBcXkAyJEJvm6M9SmcSRtBompGId+W ohzWVu9tBcXI7x+Dm2WG9GXDPEx9LpiAEdRxze1FsEaf+7+k8snGZlrM0xyG6PrhD1iqMP 27/wE9W7o5hdFEZeIBQG9IH5b2noc9N5QQZ/RaxJeWNHt0qMfodbOguVILbEXGUvy2pPxa h/misMRhyAPhs9CObzq8MRBy5fnFm3NqRLQ7jX9XCOBCA4LyGnhhDqfT8X8FmNCpvevDC4 tUA1siJBF02npmX78nyH0DYgrzPgdmIydih/X0iBYk1Wqf9fzyUC3HXxmmVn1xVVpbY/Ur 0/gsFyqwqT5wO1oLMnkSMhWFdhEdcbFvNpcl7P0jhawq8pe6fYxjlJi+3x2Ddc3bVYc01w ieZI1jfrlnnQ7zGoUkX75692Jt7xmmiy3jGZE7ygZtOiNGDPKvPBFPq/J3ic1sm3RuLtXy ORlOZvsjx3FxqGEAZAmhNjakLQsqWJartPlRhp+V4TNnmtSlwQ3RWBTGUklR+R0eLYomoj g4INvCRoKiOnR4H10XTAhDydMUg0I0yEYaDYEBK6OFn6UCEXnO7DByonYeKg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 4 Jun 2026 00:51:03 -0400 (EDT) Date: Thu, 4 Jun 2026 13:50:59 +0900 From: Michael Paquier To: Kyotaro Horiguchi Cc: samimseih@gmail.com, lukas@fittl.com, pgsql-hackers@postgresql.org Subject: Re: Improve pg_stat_statements scalability Message-ID: References: <20260601.135858.1116584574478485492.horikyota.ntt@gmail.com> <20260603.171039.1005148564287106445.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zRv4oGBBU7vmVioT" Content-Disposition: inline In-Reply-To: <20260603.171039.1005148564287106445.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --zRv4oGBBU7vmVioT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 03, 2026 at 05:10:39PM +0900, Kyotaro Horiguchi wrote: > One alternative would be to introduce a separate callback for anytime > flushes. However, since transaction-boundary flushes ultimately need > to flush everything anyway, it seems to me that passing a context flag > would be sufficient. Nah. I am not really in favor of an extra callback. I feel that this could lead to more mistakes when implementing new stats kinds, so doing your approach of using a value based on the context of the flush works for me. > I tend to agree with the single-entry-point approach. >=20 > The basic operation is common; the anytime case differs only in the > context in which the flush is requested. The flush-timing logic in > pgstat_report_stat() may become slightly more complicated with anytime > flushes, but after that point I think the existing path should > continue to work with only minor adjustments, by carrying an explicit > context value down to the callbacks. Yeah, same feeling here. That would be the way I'd use to approach this design, and to aim for one single entry point for all the stats reports and the flushes, for all the contexts. -- Michael --zRv4oGBBU7vmVioT Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmohBDMACgkQnvQgOdby QH19+RAAhr9FI3ts54jtfvg+HV266il84e0Oa/9snI+L+rnF4RTLvRGRFV1E0DhJ ErCsX083i2swRAYgNdOHkz4eR2kE5vCW0zGiwl7tAfv4kBSwnIS73CUFUbgLfnBz 3puaVyYjx2I5yx4clzPUUQrVL6zBeGgi9jaoIsa1UYY+3X9HzYXP+hlFRfENX0CJ HX3MfloPM/c34k/jHG66uAGHo+WRYJKIzwgONeJMaNYy16yKcu6a/1XVAclJwK2D UxdqOC61acfxJ7RjPKrnX8lX9HE10HzdI3asotTz1t+Mf9zQesUxVJvILfC8p7Y6 LRdNs5YQDg7HPhJEqD8aYo0uBTU7QJ9jc5aYTgEQRCR6LQXanhkvOMsVEmLJ6zgT QFYeQpywViMxDI39H7vHz/EN+2mJ07vy5kNm71TUO0WvIdV/sug05A5Y5YTvFW66 6uj9inDhx1tK74K2DKZgkDbe9RymIB3+Iv2tP7m862CdavWKEqJwyIv7a0leb3v+ XwabP4ATW1T/pPb4a67zkiLOb0D5NIfFBpdfeFQw8ofUfOighyYWH2kY2CzpoUel BVRqzLI7zxBmdkTyh2ar91PUssC3q2xSFaGheAUbXDgKTkk/yvIdSfiA3GxGMEUK kOARrMFVuC49MolAI5fkjGBa4Hn22IPc89y3mu4nfzFO/7f5cCk= =Bzzk -----END PGP SIGNATURE----- --zRv4oGBBU7vmVioT--