| From: | Beniamin Hendre <benysofy7(at)gmail(dot)com> |
|---|---|
| To: | Tim Herren <tim(dot)herren(at)protonmail(dot)ch> |
| Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Maximum amount of pg_locks |
| Date: | 2026-01-28 20:21:00 |
| Message-ID: | CAOST94jEPPCk4BhrDYSrnB80e-uq2EdY5HJ7oxypk31VYAUXRA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Actualisation script maximo plus??
mie., 28 ian. 2026, 22:12 Tim Herren <tim(dot)herren(at)protonmail(dot)ch> 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
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-01-28 20:57:34 | Re: Maximum amount of pg_locks |
| Previous Message | Tim Herren | 2026-01-28 20:12:01 | Maximum amount of pg_locks |