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 1vlC2j-008jja-0C for pgsql-admin@arkaria.postgresql.org; Wed, 28 Jan 2026 20:21:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlC2i-003Qyr-0a for pgsql-admin@arkaria.postgresql.org; Wed, 28 Jan 2026 20:21:36 +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 1vlC2h-003Qyh-1u for pgsql-admin@lists.postgresql.org; Wed, 28 Jan 2026 20:21:36 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vlC2d-002nLf-22 for pgsql-admin@lists.postgresql.org; Wed, 28 Jan 2026 20:21:33 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-658381b28e8so428493a12.0 for ; Wed, 28 Jan 2026 12:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769631689; cv=none; d=google.com; s=arc-20240605; b=YtM8pOQ1JWDgudKCGfENksLMdcQkOMIo1LMIWsOfKORENsxoGKjIMU27nB4DkxOKrk 5RVwgqf26hY27fUsK/OS0Dv2Yh2RoTNx+jKaU1XpGB+ZmEy/3Jb4rIRYyvZAB/r4v+uA TRFtFm5+clm8GGXsZGBXfNDujtF8lyAAhQsCgx302NaFVFh6hSij1vztZd9rAJqz5zrw hf5VNlNkD7gO+FoYQwmWQ0B8V/3VaBiw91EGM+E3JFVKEsTv8nNE1iOhbR6GPoeizKGr 49yTM4F9a21FQyp8Jv39P1r6DZ7p/f02C/h9HiEL32M+JS4z+hA2cfHDDef3lPcrhf2/ IJqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=7ap9ZbvHQIK+joUbw5cjTcYBXoJ4UZ0cPqw8w9Gj84o=; fh=kg8CgXi4a5uF9h37sWyYLNOYF/OdHp6Vkm+MM+Gp2Og=; b=ioFUri2NjQvt3PurbhvDIqKIHN68asRwCnbSo3xuPOc/RfSH0b7Xt/ZzeXGzo912fU nRahFxW/aMdwK/8nH1GtNL3T3AzmryNbh/Xv9bwxfYNzXeUxN2tweYjNOAxweKQNbpNz YbZ5z4M7FwYS61jEB453Jt9Z2yn9C+KhIH0+24/sZjf/9/iuQS2v5eM09Vljk8V85doJ y1JRTEN0tBrfMvwIy/MQgkE6uVhOF4eMG1lEC60G89WyO6Z74UR/WZi/AFF0yj0xiEaY GnbMfxfvXd2UDp2uQHqaGGxm7hqycpT5oJyyUaCdTAO+jSGcfaFz7T4Hw9Y55bUV+YvD LgNg==; darn=lists.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=20230601; t=1769631689; x=1770236489; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7ap9ZbvHQIK+joUbw5cjTcYBXoJ4UZ0cPqw8w9Gj84o=; b=JDAb9GV24GEoyGMsa8C+SFH44dHrFA4+2/hxITydIBqyCTWDMJ9HnpXO4ZDpQAHvLO eZOm5jfe4IZmhiDF1QqCbZBZbYVEs19OiQuOvuxRCsQEhkfjNFXjvLHBrWUKVwITJKxy t9KIL1DMCIhAK4C3pVTBfZggX7UG5FqUWpeLgCdh3zjUkE1GHe8thjSvvSAh53QMEKy0 R1z9HnypZ8U37U7++Spmy1wK4702rntGATC5/xpwvvSt3FpfWr7zOdXNawV73Y4gPhaw 6pus3SZna/lEvT1BZuFFld8j3S+goUYZA86OK+o7FKuFvwC/U0BlurxSCbpRSkUJsDX0 mujw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769631689; x=1770236489; h=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=7ap9ZbvHQIK+joUbw5cjTcYBXoJ4UZ0cPqw8w9Gj84o=; b=SKNDvTfeK4JvVvv1YyeqnXvZSEHkL78DQPtr/A0eknYe6HVCA7Q5B6S4RfpI61coS8 BucQeei84S97dpBNHLkINYJF3pZifWtERGFGRBL7I81PjfQ5xWoiciGYoctC8kUL1h9P Q0MudAYIwgP1YXMJ2eSl0gt/iAOpMhaIraqX9yBS/s4Y3SC6dmIlJUWKiUFAUPJew79e nBTDowe8u56wSdjznQqmRhwFc2aTmI0Cjfb02rPF9N6xfrHRlQpEqOu9n6WwS9QH/gRq OxyUYZUm9cBhjle5KgThftGEXiw69zblvIFfZyiP/N6tu7qjJj8WKvyLCpmTB2d8kwE0 WXIA== X-Gm-Message-State: AOJu0YwJXZgXNfb3r1mdRQ4yn+HdyCczrwT29GUJ2uw1r2QR3YeB8Xu8 VX1cjV2rAEZpQ68XtWUluYXIvhfH1E6wMCjfzGGRgVu/rM0tktyDBHPfePttUKvYQ5AA3lpMHcL Qx9pc3q8DplkcJT+gKaYxOGnzggoLf5E= X-Gm-Gg: AZuq6aLSmKiREJaGSKa8vIW8mCK/vQanCLuS2nEhc5tSOHqX731uf0/x1FgjPiv+OEl mQcCOnGiZmmzO74Eyu4wGLdQSpA+RnhsGw0HQtY3XSBI8sDlowM0g0isQrjdD+DJJjrR5mE2hws icVdez+BrM/ucST5E11YgeROnNg0fsXq4xpQtxqYQkMpqt2E0rNOZx0TV2g3HQ+7aGAyaQlg+75 1DCmOWMArVQB/omR/mO9dolbvuVsRO0SnZcBg88XBmE3r8SNQVAta/J7JMnJHiRb8GW0oM= X-Received: by 2002:a05:6402:35ca:b0:658:cc59:1624 with SMTP id 4fb4d7f45d1cf-658cc5918f2mr141699a12.5.1769631689252; Wed, 28 Jan 2026 12:21:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Beniamin Hendre Date: Wed, 28 Jan 2026 22:21:00 +0200 X-Gm-Features: AZwV_Qhlh1oPG4Wr6Yt19fDk1sv5eCRHLmf44Iy2RGYDiVUPPKMt6EHUtNbjx0U Message-ID: Subject: Re: Maximum amount of pg_locks To: Tim Herren Cc: pgsql-admin@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000038a0410649787c67" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000038a0410649787c67 Content-Type: text/plain; charset="UTF-8" Actualisation script maximo plus?? mie., 28 ian. 2026, 22:12 Tim Herren a scris: > Hi > > I'm trying to wrap my head around the way the calculation for the maximum > amount of locks works in postgres 16.11 > I already came to the understanding that the maximum amount of locks are > not on a transaction basis, but rather influenced by the setting > "max_locks_per_transaction" and the "max_connections". > I'm saying influenced rather than calculated because on my server a simple > multiplication of those two values, set at 512 and 180 respectively gives > 92160. > > Yet I regularly observe around 119k locks during my backup using "pg_dump > -Fc". > > postgres=# SELECT > locktype, > mode, > count(*) > FROM pg_locks > GROUP BY 1, 2 > ORDER BY 3 DESC; > locktype | mode | count > ------------+-----------------+-------- > relation | AccessShareLock | 119948 > virtualxid | ExclusiveLock | 2 > (2 rows) > > The database I'm backing up at that time contains 242 schemas and each has > around 500 relations (a mix of tables and sequences). > So that matches pretty well. > > I've verified that my configured setting is enough in the sense that I get > a usable backup and my database remains operational during the backup > period. Non the less I would like to understand where that difference comes > from and how close to the "actual limit" I am. > Please let me know if this needs more information. > > Thanks > --00000000000038a0410649787c67 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Actualisation script maximo plus??

m= ie., 28 ian. 2026, 22:12 Tim Herren <tim.herren@protonmail.ch> a scris:
= Hi

I'm trying to wrap my head aro= und the way the calculation for the maximum amount of locks works in postgr= es 16.11
I already came to the understanding that th= e maximum amount of locks are not on a transaction basis, but rather influe= nced by the setting "max_locks_per_transaction" and the "max= _connections".
I'm saying influenced rather= than calculated because on my server a simple multiplication of those two = values, set at 512 and 180 respectively gives 92160.

<= /div>
Yet I regularly observe around 119k locks during my backup = using "pg_dump -Fc".

postgr= es=3D# SELECT
=C2=A0 =C2=A0 locktype,
=
=C2=A0 =C2=A0 mode,
=C2=A0 =C2=A0 count(= *)
FROM pg_locks
GROUP BY 1= , 2
ORDER BY 3 DESC;
=C2=A0 = locktype =C2=A0| =C2=A0 =C2=A0 =C2=A0mode =C2=A0 =C2=A0 =C2=A0 | count =C2= =A0
------------+-----------------+--------
=C2=A0relation =C2=A0 | AccessShareLock | 119948
=C2=A0virtualxid | ExclusiveLock =C2=A0 | =C2=A0 =C2=A0 =C2=A02=
(2 rows)

The = database I'm backing up at that time contains 242 schemas and each has = around 500 relations (a mix of tables and sequences).
So that matches pretty well.

I'= ve verified that my configured setting is enough in the sense that I get a = usable backup and my database remains operational during the backup period.= Non the less I would like to understand where that difference comes from a= nd how close to the "actual limit" I am.
P= lease let me know if this needs more information.

Thanks
=20
=20
=20
--00000000000038a0410649787c67--