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 1tSQiy-00GSlT-NY for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Dec 2024 01:07:09 +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 1tSQiy-00GX6z-2z for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Dec 2024 01:07:07 +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.94.2) (envelope-from ) id 1tSQix-00GX6r-QE for pgsql-hackers@lists.postgresql.org; Tue, 31 Dec 2024 01:07:07 +0000 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tSQiv-001Kru-37 for pgsql-hackers@postgresql.org; Tue, 31 Dec 2024 01:07:06 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 384BF114014B; Mon, 30 Dec 2024 20:07:05 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Mon, 30 Dec 2024 20:07:05 -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=fm2; t=1735607225; x=1735693625; bh=ds52aEF3Q9 bV71urzQ+rg0oQGyUqECgQLqyWOexoOaY=; b=INDu+8c06E6fg2PE363zLAHmDB 53cpdvpgfv7eA+2ctSdzy/WhMhdQKRSCNNrKgLXfHVAQuEDt0aaIJVjJtVp7qcFC MxFl1rNoqKyod6HzPXzXGSZLMkPOi+CVEug2xuTlarNpLxQRWpm/gzu9gMwrg+m0 6ejt7kgCTmoQJyV7aTT8a1vCvfEzIvrxxh7+CB/FRFjn6q2F3U4FkbYo8JcN01IW 3ZUqrceMWq238KiB999YrqCHwqMv0JxVRAapEmq5SFasLHjKmeDtFatZBZ97sPd1 3MQLfcXnG7WdM+vha/hx3yRKHJCOfnfj9vsgb6avJiQ6D3GYVIvdp5cElPgw== 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=fm2; t= 1735607225; x=1735693625; bh=ds52aEF3Q9bV71urzQ+rg0oQGyUqECgQLqy WOexoOaY=; b=f2P2AujforRPzOJXVZzAW9vZqIWnAq1swBGibBgtl1K5uzcr8ZG GqmMHpkM2o5RDF5y97SIMnoV/g82YJLMLtULipUyLlPl4T5pl6nxNVYAUZxazGS7 W6pR8IeV5E71QLsNKWkyVkAqBnz41sVToiO+j0bhuQ2hvxdRTcPhXyMAMyNNsUPI E7FGwbhPpGS3eh7xD7O3e5j3r6NdyB6r2RuQk40sf+Oao4GzRCAVU5pbrUVcrWno G1fqVyZhO41j56TYqBDsV8KLq0C6KYx+/515fQxldLm09qKM0VXzylozvmwn8IAy 4q68MDnUjdPITeIooBvqWu6RgwV2+JbtldA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddvjedgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepthhomhgrshesvhhonhgurhgrrdhmvgdprhgtphhtthhopehqihhu figvnhhhuhhifhigsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhosgesgiiiihhllh grrdhnvghtpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghs qhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Dec 2024 20:07:02 -0500 (EST) Date: Tue, 31 Dec 2024 10:06:45 +0900 From: Michael Paquier To: Tomas Vondra Cc: wenhui qiu , Robert Treat , PostgreSQL Hackers Subject: Re: PoC: history of recent vacuum/checkpoint runs (using new hooks) Message-ID: References: <8df7cee1-31aa-4db3-bbb7-83157ca139da@vondra.me> <00d42567-22bd-4ed2-b190-188e9c151e28@vondra.me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oa5H/Kg8kVK1GI/B" Content-Disposition: inline In-Reply-To: <00d42567-22bd-4ed2-b190-188e9c151e28@vondra.me> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --oa5H/Kg8kVK1GI/B Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 28, 2024 at 02:25:16AM +0100, Tomas Vondra wrote: > And the more I think about it the more I'm convinced we don't need to > keep the data about past runs in memory, a file should be enough (except > maybe for a small buffer). That would mean we don't need to worry about > dynamic shared memory, etc. I initially rejected this because it seemed > like a regression to how pgstat worked initially (sharing data through > files), but I don't think that's actually true - this data is different > (almost append-only), etc. Right, I was looking a bit at 0003 that introduces the extension. I am wondering if we are not repeating the errors of pgss by using a different file, and if we should not just use pgstats and its single=20 file instead to store this data through an extension. You are right that as an append-only pattern using the dshash of pgstat does not fit well into this picture. How about the second type of stats kinds: the fixed-numbered stats kind? These allocate a fixed amount of shared memory, meaning that you could allocate N entries of history and just manage a queue of them, then do a memcpy() of the whole set if adding new history at the head of the queue, or just append new ones at the tail of the queue in shmem, memcpy() once the queue is full. The extension gets simpler: - No need to manage a new file, flush of the stats is controlled by pgstats itself. - The extension could register a fixed-numbered custom stats kind. - Push the stats with the new hooks. - Perhaps less useful, but it is possible to control the timing where the data is pushed. - Add SQL wrappers on top to fetch the data from pgstat. -- Michael --oa5H/Kg8kVK1GI/B Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmdzQ6UACgkQnvQgOdby QH1EvhAAnJjKYc2GbwODwDXvagOsuee0041bN1mNyoauL2iNmH9W8PgSeCVU5msf 14jUpVyBkpvhcK8t/DDPi1UI/i8QsMVgDjQAR/3bbNipGIn3UImgc/PcFBdYZauP W+HGtYm5XE4bDdRS4rKQ3M6aKsBRX5+LwBsZh6qaUVIPT+QtoxhK0U04HOEDs1ls Q5xjZfQ5dji4UDQCAaYL18zZZBUcBA5LU46+2UWRSygUz8r9aqaKsohc5Q0gVK3u +I5kqybq0Jf/nuF7zsadtJzsxXRXvgvrCBarHyB9GUD6TClPYMcA+vlsXHh/OgRS KqPVtxG8ZhujYFcTcwYuGYd+vI+hdOv7djMEcS3ilYVdJ/3wPt4zkhF8oKNsWAJh wphLqmDLpqItYSP7fHFITkWBB31/+n3svaMwlW8wnVIjWO6AEQHnG72RJbax4iDC w61q1igAB8bNMXqfqoOjLjXdrZaK3S7WXtnQS9aoYRekj+vIFTRIGAxZw7Z28UYv FZWJrtgRy+LXFFVAsdSZcOHw6VczITZh648QOvN9VF/0l7lYwl3mwMnHRlhG5EgR m4WjXq98gUECnPCVeF3+5cOrfntJ1EtliIiL6bSahQ3gKJW1lVYhrdOTlXECP2DY eBzvTykGoUeUz0+AiUyh0rD90VGaZM5onDpoRfXzhzWBda8Efbk= =srQ8 -----END PGP SIGNATURE----- --oa5H/Kg8kVK1GI/B--