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 1w8LAM-000RG7-2L for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 16:45:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8LAL-00732F-1q for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 16:45:09 +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.96) (envelope-from ) id 1w8LAL-007322-0d for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 16:45:09 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w8LAJ-00000000ELA-10TR for pgsql-hackers@postgresql.org; Thu, 02 Apr 2026 16:45:09 +0000 Received: from [10.0.2.15] (unknown [130.41.208.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4fmnlL0dJdz49PsK; Thu, 02 Apr 2026 19:45:01 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1775148302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ZVnzYG8vyxrqLCYKQFkdRg6FJjLE5UCFuCWF6xbw5E=; b=Dql+h3QG/kzQX53+7ppRGhXT32C2McPDAV4OnRmEOiHjIWF2KqxIIyY4kkyIJZD4i39DAP rXyP/HdC7AsfIh+g4185slQ/Tre0Qat5kJ3WB6kR46IEmDKD4j8nnHsBxuWFrh+5nR3xVa fR8sx83XYSRer+9VzKDEG5TyM4Yj/rzHRcrzbz8iEMb3U9Uqy8xyMg31aWSuZRL84hEFsf VB2kPm2R49OOnRynzLqHDalwAWVvi9y1tQ37b6VqP+PpGRY1aVj4MheKZ2ZDatl3XQ/U+1 psWzY3GCA91JXCNnaGrQzENz9AiAyOk/J95Jo49JsLfzg4AWVeYu8/yupe9PHQ== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1775148302; b=M0YRnG7e7hh0c8cCtvT2/8lpuNwLmSo2RotDrbVe7U37nqJx+Zvzvg9jsYi1+iVtoRo9cF o/BH3kn4PmU7YjTuwWc1uu06flN1h0ioiJGWlGwqZaKuh+WZIZWxWoUr12OQW+FQZzCz4y jo2nXGl1Wk6AOX3vLElLwZt89vD+/ox3G4E7L/jiKryCY2lNA4IvWhxd5wJfdTOjcldzV2 sOBgG1YtB9YnakUC2HSO7j/strVET7UMgc0/k5bf3O5odmYHBKBRwu7bX9wVTH/iquW8LK zoHqpLBHi7AQBFJcWxZsi/2cdFn6nmmlE3Fpq9vZBsjNCSgPP+W6i5Fys4yFFQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1775148302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ZVnzYG8vyxrqLCYKQFkdRg6FJjLE5UCFuCWF6xbw5E=; b=jzFUlFI0hajkOmjugsR+2zHUVmhPNgMU5/tvznOIajDhymgE4Ybw/Bbyu1EOZbmxW/H6PG DviNslUsik1Mwv1Fn/UWvxoplQ+Hm19n8vY7muwnvwNG4YgVteSivQ/gCr9RcnWAprh/HM 03qYynqNOIZpVYYDD2SIuqo5Kd8b/u35TM7V8AAgY+Afn/gA+PNj2tXt6DRrog6sk623Jo HsLy0gh8AqWcPQt7M9ciJ1+l2GDnJKEPCJB+2YdcxOnmbTxD0keU7ZCleAXXPsMWuwxTif GCf/q83ucEWUFzUWAHBRvp0pU6s+Dm3iq3pWvjICISnyiX4jQ5zhz60t5vfHog== Message-ID: Date: Thu, 2 Apr 2026 19:44:56 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Shared hash table allocations To: Ashutosh Bapat Cc: Tomas Vondra , "pgsql-hackers@postgresql.org" , Robert Haas , Rahila Syed References: <01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi> <2981bb36-6bbe-4bdc-9a94-29b1114c79bd@vondra.me> <3026ec05-f664-4ebe-8bf6-0a1218b234ec@iki.fi> <19945803-6bcc-40fe-a14a-7dc5c462ed80@iki.fi> <83e37829-0d94-49b2-ad48-5feb7b5d5e44@iki.fi> Content-Language: en-US From: Heikki Linnakangas 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 02/04/2026 19:13, Ashutosh Bapat wrote: > On Thu, Apr 2, 2026 at 7:44 PM Heikki Linnakangas wrote: >> >>> I think we should highlight the change in default in the release notes >>> though. The users which use default configuration will notice an >>> increase in the memory. If they are using a custom value, they will >>> think of bumping it up. Can we give them some ballpark % by which they >>> should increase their max_locks_per_transaction? E.g. double the >>> number or something? >> >> I don't think people who are using the defaults will notice. I'm worried >> about the people who have set max_locks_per_transactions manually, and >> now effectively get less lock space for the same setting. Yeah, doubling >> the previous value is a good rule of thumb. > > Users who have set max_locks_per_transaction to a non-default value > but have tuned their application to respect those limits are safe even > after this change, since their lock hash table never used wiggle room. > Those users who weren't careful to respect those limits will need to > bump their setting. That's technically true, but in practice it's very hard for someone to carefully tune the setting. It's difficult to know how many locks a particular set of queries take. In practice what people do is they bump up the setting if the get the "out of shared memory" error, until the error goes away. If you do the tuning that way, it's quite possible that you are relying the "wiggle room" without realizing it. > I think the release notes should "nudge" all the > users who use non-default max_locks_per_transaction to increase it if > they see "out of memory" errors. I don't think it should provide a > blanket advise to double their locks How about: "If you had previously set max_locks_per_transaction, you might need to set it to a higher value in v19 to avoid "out of shared memory" errors. If you are unsure what to set it to and don't mind the increased memory usage, you can double the value to ensure that you can acquire at least as many locks as before" TODO: do some more calculations and testing of how exactly the doubling rule works with different values. Is it guaranteed to be enough in all cases? - Heikki