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 1w8eBy-000k5K-2p for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 13:04:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8eBv-00BeWg-1K for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 13:04:03 +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 1w8eBv-00BeWY-0C for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2026 13:04:03 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8eBt-00000000MDQ-2GAC for pgsql-hackers@postgresql.org; Fri, 03 Apr 2026 13:04:02 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43d01d6b50cso1673327f8f.1 for ; Fri, 03 Apr 2026 06:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775221440; cv=none; d=google.com; s=arc-20240605; b=bMVVGGTureL3Bq8hrXvZH233pynzxH/FbfsrNnCmJd8HoAAcVa8DWbh1UKZyundR4G RPW4QuFEOG9lOHebN+wn8HNmB/ET2TK9arr5ktakYyEwvW/Edjjr2CgfhahLvxzZ/le1 glSUUA8I53lH2VLHBhFkFXtccUuROjMqCWzCFfy26+NV05GGXMim3vgdVxASCDO03/4T daDobJkXblN+Hawdx2zxt+cDwqSzvxkqFQG27YXsG6F5d5Ih2/9rrscNKI5UMq+aZSEO MttAIvmsV8+aujfCVzKPm4FpqlUGgFJq7XmNsdDG3OA+Se3n6BWQqXLmjriQ8YdcM2S0 V75A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4bBxYgW08FcLyW7W0DaxW/s4IESVvCaZ3EGHXZVQNnc=; fh=yTEhbRmL7zbKTy3aCmurlE/EwoxwLWLBgAjZxaWOoFo=; b=XdFMPRI81X1kzeULz5AOg+xIPrGkTAq6WKe4n5UfPuoqxR6u6KnBxoy8ui2QUoWbbc /FDY/FgQ4Y0NNwQoB53ZlyU5u3g70ZMi/waX7xEhknzU9nPiyitEwYePbdcwEw5q5uQd BqQ0w8Rfahl6n2uWOp6kHBBpNZl3rWiChV54e5afvOREJsqev/PC1jbh60HWB/poh8t2 lSenip4O2K5OpmajQ9Xb+7wzdfF5llvXp1+ZXjPn+05JF0Qqz13V1dDarq1/fdogOXUK izlsZaZ4y2ktvVstomft3szeK4gsiEFcynQhcGuGsO35Z+rOKapjBkjhDyN3jirq15ER 3xkw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775221440; x=1775826240; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4bBxYgW08FcLyW7W0DaxW/s4IESVvCaZ3EGHXZVQNnc=; b=qKbxQBj6nRcavXZ44fITFtpIpU55lGffVoMRP1MbkBQEbHddW6/S8sfhn4FZfxrVk6 lAslZnr7FeZ69emFfuKeD3D25mkXjsZKD+KX7bkoNNwjv+X3Acsahw4xN1WMPCmStPZP 67B/EHhRdy22fXxvJi3ahmCvk3g2m/BnM571QoRJvsgM+OPsIOoENXwD6AbxMnIW7SEb ei1oerVsrD7pd5uh1ZRmNlfiVWfaTMkoAkrC5ULhx3UP4aXVfEvIvSFfoi0aF/tiQCI8 1tvepv9bu1NCNGZHvXMJxECiT+5n1fu4LKAmSrezZd7zJyX67IRpgIaQzk9z4zdbGwei xFzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775221440; x=1775826240; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4bBxYgW08FcLyW7W0DaxW/s4IESVvCaZ3EGHXZVQNnc=; b=erdvwNZVmPDXAtBT2xOF9iCPb4YhZu4+eO4kT9OIa3A2t337VWFI5BtOgNp2tzT+Lu A35lmaYXD1UiP7E7WZuqLCbHKKpCWQd47EjjgNkcPE6ZbBnQFBYhNYdhy05oUcwwFKSZ PC7gcNrHcP242gMrlab6VafjjdPCyLcpvZbBF+iOZnq2rhzupYgZmGdxAg3yDUDwCYJq wrPE+XUylc+38C9L9ujL2KICLiK11tmX5lBOvIO3PYCEXazlqkP5gfnnhnC47pTNqF8q B++u1otP3VhTPdsAGMQJsGwKZ1uLatPJqD7fwIl8oMvau23nmHFxTambcjm8j20PMCO5 BSUA== X-Forwarded-Encrypted: i=1; AJvYcCVwomEWx+GbS0ep1OaVpo/m+m2mfzq+TTABye51qOE6hDFoo+9QGKsvM4n/08Lt8NN8p8vZ/m2HQTCIJwW7@postgresql.org X-Gm-Message-State: AOJu0Yzo6+fWSEL5uBQssA/iVc34ycp3ho87JoJ0baEUEqMY9s6eu6kQ Jb3yEkPS7sPjWscmaZ4VOMQUlr17giHOdni9O3wC3vOevJNRc9Ju+gnz8gBxABD/vxc8xqoHTxN FaKKeJHQQP04bfDKZ0EvjnkB8C9CMvPo= X-Gm-Gg: AeBDies3JMldJ7kjgoymHoOu+h6Lt2XwbiQkWkB3oCZshy9b8kpNmQ/rZQylnwih+74 tgWxzCZGUE++MYfYxW7ZoQmv3dRDfHZfayYeyLsbKxzhL4iNTq7YP82PPOlAm1QdiEaA9+xLlSJ yrEf73gum+BIH1QonvouyNVG8hCHIh+PaeQEsLLbsWVuCQcPk6SZVHXwo1WpA42wiX0AWE4tGhf 8rznzpJEmXlicIMT2rz9saiK4Ru2k2WWK1lANcni1G9AmpF70K16hRlQBP+IofI1BhP0WqD/EUv nfcox/y3yQ2nHIPH1/m5YkfTV2ylzaZGa6zYbIhBWvuFhEzogKc= X-Received: by 2002:a05:6000:1a8d:b0:43d:b99:bde3 with SMTP id ffacd0b85a97d-43d292d51e0mr4712856f8f.25.1775221439750; Fri, 03 Apr 2026 06:03:59 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: Ashutosh Bapat Date: Fri, 3 Apr 2026 18:33:46 +0530 X-Gm-Features: AQROBzBqurruKw0QBUqiwCnIaJ5nFGNdHEYDYdfZ6_NFlJ_x5UVlm5ss6VbFqG4 Message-ID: Subject: Re: Shared hash table allocations To: Heikki Linnakangas Cc: Tomas Vondra , "pgsql-hackers@postgresql.org" , Robert Haas , Rahila Syed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 2, 2026 at 10:15=E2=80=AFPM Heikki Linnakangas wrote: > > On 02/04/2026 19:13, Ashutosh Bapat wrote: > > On Thu, Apr 2, 2026 at 7:44=E2=80=AFPM Heikki Linnakangas wrote: > >> > >>> I think we should highlight the change in default in the release note= s > >>> 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 the= y > >>> 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 worri= ed > >> about the people who have set max_locks_per_transactions manually, and > >> now effectively get less lock space for the same setting. Yeah, doubli= ng > >> 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. > That's true. > > 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" The wiggle room is 100KB fixed + 10% of other two structures, so value by which it should be increased is partly fixed and partly a multiple of current value. "double the value" is simplest advice we can give. +1. --=20 Best Wishes, Ashutosh Bapat