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 1tbEBf-0093Nu-TI for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jan 2025 07:33:08 +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 1tbEBd-00BkDE-47 for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jan 2025 07:33:05 +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 1tbEBc-00Bk5C-6w for pgsql-hackers@lists.postgresql.org; Fri, 24 Jan 2025 07:33:04 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tbEBY-001EFG-0X for pgsql-hackers@postgresql.org; Fri, 24 Jan 2025 07:33:03 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id D83E1114017C; Fri, 24 Jan 2025 02:32:57 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Fri, 24 Jan 2025 02:32:57 -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=1737703977; x=1737790377; bh=NSbl3fpzlZ yST4N4hXeeuQ622WyYek6vap0X13IrQ9s=; b=gPlnKYpA13nYoHib6nMGkw9A9p 9U9K4XIOT4DfD7/fZNlF+/Yhhd/8PJ7CxOr6z+5lIlpfFuULoQY6Of2mJzObItu3 DDlw6VewbcUELCkClyHnwVwzMOFrJu+4lVBHe6P++3/WBQxxLEiwU+2eU9Mo5TZb hYeTEAdME+GygOHC0S5T/YPaWqorAe7897YFQk7w6ONehUCjokacCUSKCEO4OoTl dOA8iYRfqVEmcSX09ygHQKhUi8BpaIe/vMpsNBM4ACG4cWyNokwueI4vUhRL9+x5 qrMOiN92L+BzgSuTHCuaZEooexI4JmwEp7yZZNxVuJRFjypZQgAl+0ZD6F7Q== 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= 1737703977; x=1737790377; bh=NSbl3fpzlZyST4N4hXeeuQ622WyYek6vap0 X13IrQ9s=; b=Ci28wbSjS1L7cAtap0NJiYf0UlMq19lRgShW6LQQIIAKLGmTR2z oSvLphiME2PAg42ktHG8umRMhSECW8Z7lQaxkXGHuPgccFWIq4e+ISDU1WmzyslA 1Egz0pIZtOnQt9c97RMF0DdDG7DoSYYxdopKc+eyoW/Kg4fb0290Ex1v5FwwzDSl OuBZx2bvC8mM0ArFYateKaQJ9hzUXKQQKLcetLW9xJpBB6LIUCPFTxEaSly1LalI Iaov7EgLip/J5imge/0Mhg2H1VXYcqAxPpaUr992NxEveZwx/KFvK/Ic4NaadKtK Rs5A5SAvxMiPmFHkcK0rjvgUabafNSXyEbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgfeelgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffk fhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrh cuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeet leeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghl sehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehsrghmihhmshgvihhhsehgmhgrihhlrdgtohhmpdhrtghpthht ohepsggvrhhtrhgrnhguughrohhuvhhothdrphhgsehgmhgrihhlrdgtohhmpdhrtghpth htohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Jan 2025 02:32:55 -0500 (EST) Date: Fri, 24 Jan 2025 16:32:45 +0900 From: Michael Paquier To: Sami Imseih Cc: Bertrand Drouvot , pgsql-hackers Subject: Re: POC: track vacuum/analyze cumulative time per relation Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/u52U/I5WAMPALk5" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/u52U/I5WAMPALk5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 20, 2025 at 11:04:40AM -0600, Sami Imseih wrote: >> + PgStat_Counter total_vacuum_time; >> + PgStat_Counter total_autovacuum_time; >> + PgStat_Counter total_analyze_time; >> + PgStat_Counter total_autoanalyze_time; >> } PgStat_StatTabEntry; >> These are time values in milliseconds. It would be good to document >> that as a comment with these fields, like PgStat_CheckpointerStats and >> others. Perhaps they should be grouped with their related counters >> within PgStat_StatTabEntry? Or not. >=20 > done, including grouping all the vacuum counters together. I was referring to the order of the fields in the structure itself, but that's no big deal one way or the other. > See the attached v6. + PgStat_Counter total_vacuum_time; /* times in milliseconds */ + PgStat_Counter total_autovacuum_time; /* times in milliseconds */ + PgStat_Counter total_analyze_time; /* times in milliseconds */ + PgStat_Counter total_autoanalyze_time; /* times in milliseconds */ This should be one comment for the whole block, or this should use the singular for each comment. instrument =3D (verbose || (AmAutoVacuumWorkerProcess() && params->log_min_duration >=3D 0)); + if (instrument) Some noise. if (instrument) { - TimestampTz endtime =3D GetCurrentTimestamp(); On HEAD in the ANALYZE path, the endtime is calculated after index_vacuum_cleanup(). Your patch calculates it before index_vacuum_cleanup(), which would result in an incorrect calculation if the index cleanup takes a long time with less logs generated, no? Sorry for not noticing that earlier on the thread.. Perhaps it would be just better to pass the start time to pgstat_report_vacuum() and pgstat_report_analyze() then let their internals do the elapsed time calculations. Consistency of the arguments for both functions is something worth having, IMO, even if it means a bit more GetCurrentTimestamp() in this case. -- Michael --/u52U/I5WAMPALk5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmeTQh0ACgkQnvQgOdby QH0TWA/5AeXPkaXn2n3imiwwcnaGAOFER6oPhptaZoCVz0ywlea2rxlFfHttj38b 9vDq40FgyxRvdQCb88dyW78Q+VXbV4atSTGr2IqZorNIQzSxLybE+b0I6n42no/H cHwlDNmj39pvvDwctklYLN6GE5M+YAo4CiZoonpTaXQYBlO1V07L8k7fC5bhTgZk mFDrLHgRJ8aVki91++cCU8UhL9Jfp5zrr9sDfdU8t5PMNnu3nchv8NHcEA8KicY3 sKVOpqnSYHHGj/+fTuiiqIkz4YOf0571AvL7uVx/Fj+dkwixni4QibnrKhQ+HVjb ooZAyyf1SvQ++JEFTrk8avxOKd2bcNA+Y4aHwpdF3ITM5+IoBtxpSuLQ5PaAllX9 mXjHGFLPY1AoogxiD8+mCmCwnTZEPYlt9fMEXXzqxnoAjI7C7+xPAxyb2Ha3XfA4 fqSoeYN4JXOKweOAeUUEKZS69fQNu/wK7kwZf6tSJNVIuOUt1a2fS/Lnk11p+0Qy jmxCCrJBqIOKOSaqSTtG+C/Du3C6ABv/729ZUY8Hc9YGISWjnZJNPACsMl0G6P+w dltQl02cpbU1hWGc+5VARsECsiub9e0dadDBsvOJOWsFhi2Ot8rFZYr/NZ2R7y7R TlzjaXD8i+0lQUUhtZELLC3vUPTdiC1DLSKkFQ+bU60vO2DpEio= =zss1 -----END PGP SIGNATURE----- --/u52U/I5WAMPALk5--