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 1w37OE-000utj-12 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 07:01:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w37OD-00GsXt-0b for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 07:01:53 +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 1w37OC-00GsXk-1Q for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 07:01:52 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w37O6-00000000Ueo-0BHu for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 07:01:51 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 4B35A14002EF; Thu, 19 Mar 2026 03:01:46 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Thu, 19 Mar 2026 03:01:46 -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=1773903706; x=1773990106; bh=0YJHtQU94j bl54IuE+jBY0VhfKtzJbsnZefsl8mpBmA=; b=vFKtvpec2P7Avlc+A6SD7lVnm6 W+5XA29f9YU6sTDb9MzjAKiBqqNTTqvjCfIfk7pi2Wt6hICc0VA1n0XMPZdex9PT UFARs2ywG0g5wnvcxezh/eN3KDKi77QSmpRP7XwDQlQzjBsL1s/gmhY5jS8/cl3K KSCZ7a+hGiMlJNnwLwtwO6uN+pEqmGBrfaMpOQNFi6BRrQEdxx8nIDNpgiLJvESG aBeLoibmAo5dgam0F3u3acrPpKKUwGJDcedn5U8VXTyzKn1Hk7V5hwN+Vl3amfkA WubKf1ZD1k3Ewm8JvXufCasXuni4v7j4iKDVvIL0VOOr9AxI/UJmc2QKafYA== 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= 1773903706; x=1773990106; bh=0YJHtQU94jbl54IuE+jBY0VhfKtzJbsnZef sl8mpBmA=; b=kF2iQQ6UqtTyaiicTf+j94ycmQYw3pCIOBGKQXvCNkSZKLXLF8L TIXfL1cdNVJo4N16JGJkqaaXEB9tc9KcgkEfZlfL0AJrMxMH4f7mYv3iau7HRBrt 6KAPBPQx+fr+Xr5ZW4byJ6XAVhyVpWlNCdvCXBjTdvLf/tIkAGxlrGc8DUUCq/2C OOleK6phoL8eEWzm0LlS1injeoVLLut+41/zRR1rdoKL2wta0oN1W/JgDjmLgNU7 KHWGpqewIGsdwMY1c4S+6zkV87633TOA5Zsndl+K91xCNxHVw70pvkDyJ1BjuCBY +NQw2F6bS82udFtmT7LlUWoGqrnze7sGlvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftdeifeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsggvrh htrhgrnhguughrohhuvhhothdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghn ughrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtohepphhgshhqlhesjhdquggrvh hishdrtghomhdprhgtphhtthhopehhthgrmhhfihgushesghhmrghilhdrtghomhdprhgt phhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlh drohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Mar 2026 03:01:43 -0400 (EDT) Date: Thu, 19 Mar 2026 16:01:39 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: Andres Freund , Jeff Davis , Greg Sabino Mullane , pgsql-hackers@lists.postgresql.org Subject: Re: Adding locks statistics Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aklLOoCAuKvq8w1F" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --aklLOoCAuKvq8w1F Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 18, 2026 at 02:51:01PM +0000, Bertrand Drouvot wrote: > This is done that way in the attached, so that we don't need the extra ou= tput in > the _1.out file and the test time is reduced (since the deadlock timeout = is set > to 10ms in the test, I changed the sleep time to 50ms (I did not want to = be very > close to 10ms)). > + waits bigint > + > + > + Number of times a lock of this type had to wait because of a > + conflicting lock. Only incremented when > + is enabled and the lock was successfully acquired after waiting = longer > + than . > + > + It does not make much sense to me to decide that the counter is incremented if a GUC related to a control of the logs generated is enabled. It's a fact that log_lock_waits is enabled by default these days, hence we will be able to get the time calculation for free for most deployments, but it seems inconsistent to me to not count this information if the GUC is disabled. We should increment the counter and aggregate the time spent on the wait all the time, no? + * Copyright (c) 2021-2025, PostgreSQL Global Development Group=20 Incorrect date at the top of pgstat_lock.c. storage/lock.h is included in pgstat.h as LOCKTAG_LAST_TYPE is wanted for the new lock stats structure. That would pull in a lot of header data into pgstat.h. How about creating a new header that splits a portion of lock.h into a new file? LockTagType, LOCKTAG_LAST_TYPE, LockTagTypeNames at least and perhaps a few other things? Or we could just limit ourselves to a locktag.h with these three, then include the new locktag.h in pgstat.h. It would be nice to document at the top of the new spec file what this test is here for, and perhaps name it stats-lock instead? -- Michael --aklLOoCAuKvq8w1F Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmm7n1MACgkQnvQgOdby QH3DuQ/9ENxOuJZLmFj7p+GR1M/7h3I3jM3oINYgjJwMpxxBX1UpHPBIZVCQaswx TppscT1wuMTXXAnOnKnoUmj9hlP/J9ixIqZb5a1CuWal6FGH3sObmhCfLrcrqZAP tE+lmECPzAR4QqGVdD10QhnT5VYWQE3Fyc0EmJG/z7f3Tr8GjyhKbpcosTRYguwJ C4NrojqZ/N2vDOricvfUxw/sS3APrEkpolHMDAiOAIfggRlz4S7nXzMEPZErJH8X p/FsWkAtE7XM5ADZQDwsc5AEye/jyf/cou9wLqFAIj/tPfV4+PfCJg2E8O2fxe2+ 0OWOmf/BcpzqBVbNflG6Uy+FDEPRrN7d0ntOHQ4kaF1yLb4m36VH0MBZDqUxCbs1 K8VgNyhPJpLulewIPvhsBJ2teE9QW9ochg9D8objwDdfpZwcltgQi6APd7KklD+N VUx+/cTYHKIZMvKnijupoCUZs1ms3aPhdRdApYWAXkySMQvXu6xgqPb2X7zWqcmO 3wup5UuAGLHNo6+AdqxnbEh5H55UDiMd7HCIB18QotYG29AluoOm0okz9CbNp0lg 3Ba2v+f2PlKzdlLimV9VvvJdxnYt40p1NByXzBFZfFuhO9nDNrnESFQOwWuA7i4u by9l+2TF5QYCHnLuxFwmYI6l11OlQNfN7A8+sMJqg45T95G6O+c= =2MMo -----END PGP SIGNATURE----- --aklLOoCAuKvq8w1F--