Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihuWI-00067H-4x for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 12:03:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihuWF-0006l9-Aj for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 12:03:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihuWE-0006l2-6U for pgsql-general@lists.postgresql.org; Thu, 19 Dec 2019 12:03:02 +0000 Received: from [66.111.4.27] (helo=out3-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ihuWA-0002Sw-HO for pgsql-general@lists.postgresql.org; Thu, 19 Dec 2019 12:03:00 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id B36B92247D; Thu, 19 Dec 2019 07:02:47 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 19 Dec 2019 07:02:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Vqtfe4XhdZK+XkV+ZfbCiCd0Rct5+76q++6hXw5Qy go=; b=NDKpp1+t2FMd/I8IylusUUjgv2ZOzse1FqhECKLljC2y6XA/wMIXWLBZK LOFE+jBvAE5U7r4pc00VVgY7cHw9/e1CqiFgPHh+yriU7MQdsJ9FmWDaPW2B7Au2 yS1BtdWYrLXGdmjJCqzasAA1I4E4IUvla64LU0nQCapS/NGcNYvI9XS0oxDTWF/b TYz4oMO0ZDhEcoGkV+mWhaiQ6trXZq01E3jblwnhXH/Yz3sfDRnbKLHU8kP54cdV bbEqaHN5QmQNkfAMTfckavYuGMoPaj0NEBD8JP2CB/3G7erniW0Gk4F4JE6Iokt9 2TGOOri/YTMDCGM3y7BhxIg2/0SyQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhohfkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnug hquhgrughrrghnthdrtghomheqnecuffhomhgrihhnpedvnhguqhhurggurhgrnhhtrdgt ohhmnecukfhppeelfedrvdegvddrudeiuddrudeftdenucfrrghrrghmpehmrghilhhfrh homhepphgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm necuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from april.pezone.net (p5df2a182.dip0.t-ipconnect.de [93.242.161.130]) by mail.messagingengine.com (Postfix) with ESMTPA id 6323D30609FD; Thu, 19 Dec 2019 07:02:46 -0500 (EST) Subject: Re: Max locks To: James Sewell , "pgsql-generallists.postgresql.org" References: From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Thu, 19 Dec 2019 13:02:44 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.27 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-12-19 10:33, James Sewell wrote: > I have a system which is giving me the log hint to increase > max_locks_per_transaction. This is somewhat expected due to the workload > - but what I can't understand is the numbers: > > Based on the docs I calculate my theoretical max locks as: > > max_locks_per_transaction * (max_connections + max_prepared_transactions) > 256 * (600 + 0) = *153600* > > However, looking at my Prometheus monitoring (polling every 15s) which > does a SELECT from pg_locks and groups by mode I can see there are over > 500K AccessShareLocks consistently (up to around 570K at peak). max_locks_per_transactions only affects relation locks (also known as heavy weight locks), but pg_locks also shows other kinds of locks. Filter by locktype = 'relation' to get the appropriate view. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services