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 1rnhoM-00Edaz-P8 for pgsql-general@arkaria.postgresql.org; Fri, 22 Mar 2024 16:32:07 +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 1rnhoL-005AVP-7V for pgsql-general@arkaria.postgresql.org; Fri, 22 Mar 2024 16:32:05 +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 1rnhoK-005ATk-T9 for pgsql-general@lists.postgresql.org; Fri, 22 Mar 2024 16:32:05 +0000 Received: from fhigh5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rnhoG-005siV-Ec for pgsql-general@lists.postgresql.org; Fri, 22 Mar 2024 16:32:03 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id C9E7E114008B; Fri, 22 Mar 2024 12:31:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 22 Mar 2024 12:31:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding: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=1711125119; x=1711211519; bh=WMIj5haXyoKB7hrOyQoL7qP9MPV0EnFfLWQgrQsrz+E=; b= CbHjQUm3S+r+Ym2PxSQYPptaFPzUBr1yCXI2N7AK5A2PMwaJJyfvH9I2+sbGNJia rLLSavFyAoWdUxYvP5TioLfNGMyL6anUVeXdWIOnsG8fKta8S/uzpksOF0DCBbdz rKmBTM+6Zebw7fYHTKI50HZiauMKD/AvL1PNKpS9XMfGjZOpV/M86GXQlcwE5iVd TuOSipM/COQGpsvkdYZceWIeEY/f8ERnRosBFu6/VEz7IWN5azwwF/9YVGeuuBdR h8xYPnH1oJIFaKtPRQAghsCGEeOkcIPR8w2n6kP/3YPGWf+AlynJVgDZMEvnUbsq QyaSVoJU2h3GXyoM5jHuBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711125119; x= 1711211519; bh=WMIj5haXyoKB7hrOyQoL7qP9MPV0EnFfLWQgrQsrz+E=; b=m UpY4zRWxfUn/LsDMSocMLoitBOwsK07Gm0IyY5bQ7kDCeTE0bDIPtpcTzkHnOBac RBdIRx/AomNf9mFoH6JUikmPuCR6eoy9bnwCbY5dNkNNyc9+QHOlmoeWIm8nWO9e a3cQ3oFDwD0SmBjdwU8NNE0uOQ8UlqSXDk/WbPyZ2D56knsRqNDigqPgv+/m+0tc wMxGRR2ZxvQ9JnGDYyut8WXakVqK7O7AdQUqimGumOg+hSdQvL+Vs+Zcash8qGyV +uXfKqE82N+yk4hQ8/eQ7G0uLwjTKGa5OeBM50c5PFf8kcTbIt0roZDDD5fdWU0P +S/QZ43ldTw4KHQlCeF/g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtvddgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeffleegieefgfevudehtdfhkeeutdffjeevgeffgeej vedthefgudeiteefheejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Mar 2024 12:31:59 -0400 (EDT) Message-ID: <4d234943-b4bf-4e59-aa89-e5d69e18a228@aklaver.com> Date: Fri, 22 Mar 2024 09:31:58 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Timing out A Blocker Based on Time or Count of Waiters Content-Language: en-US To: Fred Habash , pgsql-general@lists.postgresql.org References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/22/24 09:25, Fred Habash wrote: > Facing an issue where sometimes humans login to a database and run DDL > statements causing a long locking tree of over 1000 waiters. As a The above needs more explanation: 1) Define locking tree. 2) Define waiters. 3) Provide examples of the DDL. > workaround, we asked developers to always start their DDL sessions > with 'SET lock_timeout = 'Xs'. > > I reviewed the native lock timeout parameter in Postgres and found 7. > None seem to be related to blocker timeouts directly. > > idle_in_transaction_session_timeout > idle_session_timeout > lock_timeout: How long a session waits for a lock > statement_timeout > authentication_timeout > deadlock_timeout > log_lock_waits > > Instead, I put together a quick procedure that counts waiter sessions > for a given blocker and terminates it if waiter count exceeds a threshold. > > Is there not a native way to ... > 1. Automatically time out a blocker > 2. A metric that shows how many waiters for a blocker? > > Thanks > -- > > ---------------------------------------- > Thank you > > -- Adrian Klaver adrian.klaver@aklaver.com