public inbox for [email protected]  
help / color / mirror / Atom feed
From: Beniamin Hendre <[email protected]>
To: Tim Herren <[email protected]>
Cc: [email protected]
Subject: Re: Maximum amount of pg_locks
Date: Wed, 28 Jan 2026 22:21:00 +0200
Message-ID: <CAOST94jEPPCk4BhrDYSrnB80e-uq2EdY5HJ7oxypk31VYAUXRA@mail.gmail.com> (raw)
In-Reply-To: <hS-XH0n2SemZiCabUk02t2mKBBLxiFFF-iA7u_RIp8HuTPrFt1T3J_ljcMcYV7syotOSkKM7zV9jwTVcnkz356oltoxkLJjXvMIObTMP254=@protonmail.ch>
References: <hS-XH0n2SemZiCabUk02t2mKBBLxiFFF-iA7u_RIp8HuTPrFt1T3J_ljcMcYV7syotOSkKM7zV9jwTVcnkz356oltoxkLJjXvMIObTMP254=@protonmail.ch>

Actualisation script maximo plus??

mie., 28 ian. 2026, 22:12 Tim Herren <[email protected]> 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
>


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Maximum amount of pg_locks
  In-Reply-To: <CAOST94jEPPCk4BhrDYSrnB80e-uq2EdY5HJ7oxypk31VYAUXRA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox