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 1tR1X1-006lxL-Oe for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2024 04:01:00 +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 1tR1X0-006wbH-9m for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2024 04:00:58 +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 1tR1Wz-006wb9-Vp for pgsql-hackers@lists.postgresql.org; Fri, 27 Dec 2024 04:00:57 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tR1Wx-001oUR-51 for pgsql-hackers@postgresql.org; Fri, 27 Dec 2024 04:00:57 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 0834111400F3; Thu, 26 Dec 2024 23:00:54 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Thu, 26 Dec 2024 23:00: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=fm2; t=1735272054; x=1735358454; bh=l7NdiqN2wU t6RhuPWbX4R1RzGPi8x54S5L2kV4GfLSk=; b=AnsnY+bYHMSStuLAhnunhsaU+a cUD5+w3QemAC5f96SnA4zVK0zNPDlpnmYFefSku+Plb+sJ4hUf8FyrVm/iAlQsgT H0aqYPsISXSOGdBSmEfl1WltMXxEcHh5CV5lzLvVRPZ808nnXoowTUo9iaXdXe+V QR+bV3bU3SC1uO+azeOtVBW2EEk94Uw+xVfd/zNscbbflmU6qSI8IJ4aG7DZFeAB 9T0mXoEDdNRetp/WApHW4128skCGmuOJmOywJf6dOmDyR8Z9YUKOStQ8zZI+UkB2 ZTQ6j0SZSzuoC1SltIIkbs+36H22uA2LEuZwMckJr/XhQg+0tGlBvZHw3QJA== 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= 1735272054; x=1735358454; bh=l7NdiqN2wUt6RhuPWbX4R1RzGPi8x54S5L2 kV4GfLSk=; b=G5zGImbX54C9KkPxXWd0z5PYrA5jzVXvFOSN6fWJlVZYcIoFudd giFalEN869H5IrwVZqjvVowju1esnT/hVK98le21c7LGbUHXyl9mrWuWJ/oZmT0h Wb8BhgdaMVy1KxfqrP7cetxrScLGeZfGXn7MevdGp31P9D0i+14Nmpu5MCdfNYAA hhqEEki9zaWau2Ocw1MhzYHhQGY4L8kCotAOLTZvawe3crLlFCyGv4lAXSuZku3f 5AzSFXu4mQGhQSR9Hi0cRcstU83cyH3aOSoS8RDw1XPB5LIAzcnkLOCBzObIOoSP mJGh5kamPshXZCMQzGbm1Xkk32d20kkUa8g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudduledgieehucetufdoteggodetrfdotf 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; Thu, 26 Dec 2024 23:00:51 -0500 (EST) Date: Fri, 27 Dec 2024 13:00:37 +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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rAVWtuanTv+xcdc0" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --rAVWtuanTv+xcdc0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 26, 2024 at 06:58:11PM +0100, Tomas Vondra wrote: > If 128MB is insufficient, why would 256MB be OK? A factor of 2x does not > make a fundamental difference ... >=20 > Anyway, the 128MB value is rather arbitrary. I don't mind increasing the > limit, or possibly removing it entirely (and accepting anything the > system can handle). + DefineCustomIntVariable("stats_history.size", + "Sets the amount of memory available for past = events.", How about some time-based retention? Data size can be hard to think about for the end user, while there would be a set of users that would want to retain data for the past week, month, etc? If both size and time upper-bound are define, then entries that match one condition or the other are removed. + checkpoint_log_hook( + CheckpointStats.ckpt_start_t, /* start_time */ + CheckpointStats.ckpt_end_t, /* end_time */ + (flags & CHECKPOINT_IS_SHUTDOWN), /* is_shutdown */ + (flags & CHECKPOINT_END_OF_RECOVERY), /* is_end_of_recovery */ + (flags & CHECKPOINT_IMMEDIATE), /* is_immediate */ + (flags & CHECKPOINT_FORCE), /* is_force */ + (flags & CHECKPOINT_WAIT), /* is_wait */ + (flags & CHECKPOINT_CAUSE_XLOG), /* is_wal */ + (flags & CHECKPOINT_CAUSE_TIME), /* is_time */ + (flags & CHECKPOINT_FLUSH_ALL), /* is_flush_all */ + CheckpointStats.ckpt_bufs_written, /* buffers_written */ + CheckpointStats.ckpt_slru_written, /* slru_written */ + CheckpointStats.ckpt_segs_added, /* segs_added */ + CheckpointStats.ckpt_segs_removed, /* segs_removed */ + CheckpointStats.ckpt_segs_recycled, /* segs_recycled */ That's a lot of arguments. CheckpointStatsData and the various CHECKPOINT_* flags are exposed, why not just send these values to the hook? For v1-0001 as well, I'd suggest some grouping with existing structures, or expose these structures so as they can be reused for out-of-core code via the proposed hook. More arguments lead to more mistakes that could be easily avoided. -- Michael --rAVWtuanTv+xcdc0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmduJmUACgkQnvQgOdby QH04RA//Sbq3PwunCpCyzkTb31PRfEpXDryyW6zpBlryJ+fNj62qhQQk61IH1mRf 8WkJBFlfrifNWZaaxzd+rQj34dpX/0R1GZm+IohJhgiaVNaDSb4z3LAwLFqACNBS s5Y8laahhbAjui4L1KNoU7bV6wN8gnDgjeZXjtddtjyAwwpKtHajoqJw02MTjuxG 7CfI7wco3vdoBtz5URqthGqtkiuP90jN1sc/VjS7+HX3emkugAc0VBD7t+Ns4Hxe i432nA29H6C2ZWFRM/v1LNt5QAdt69vnfqNN2eANK0CrH3kLQjTr1FZB9WZiDZd1 UzEdpD7rd94B0I1iyIEdoTHH0ud6FWCmEi7NkbA1HquOMzvxRINgHy8fgFsewBgu 3a63Fe+aMq4C7f6sZIM+upAHTWgbQl6LS7r3ZvsQwcWOBQOEk/mkS8BhbqtnhjHm UzZTau8M7RVpX2fxijRAPESLuiQR7eFOepW83qjX84TMmMpxdgEqxAlgwyIFVd9N qBrn7ZUpUiADhpp7sbpzsLk62FhLIFD30jOQsylvQNgTI5VxjbhJcSHbhc6ZQrOw MfpYfMx2qy94Szcah5YrMs3tLdGuuwaHzrNHay7HnlbIThh22c5TaV8idl0K6lrE 7YJuoPupbusr5nCoiy1Ppr3OOAd7rmjx7ZKdXYXJP2A3/egWrZo= =ZpxG -----END PGP SIGNATURE----- --rAVWtuanTv+xcdc0--