From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: James Sewell <james.sewell@jirotech.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Max locks
Date: Thu, 19 Dec 2019 14:19:08 +0000
Message-ID: <87immcbesb.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <ae27bd07-a93f-9274-849a-12dc35228745@2ndquadrant.com>
References: <CAANVwEvRv0ZKiZvVeFJu=_d2XzBwv+MhidzvUWF6L6+of_DBhw@mail.gmail.com>
<ae27bd07-a93f-9274-849a-12dc35228745@2ndquadrant.com>
>>>>> "Peter" == Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
Peter> max_locks_per_transactions only affects relation locks (also
Peter> known as heavy weight locks), but pg_locks also shows other
Peter> kinds of locks.
pg_locks shows exactly two types of locks: "heavy" locks (which are not
merely relation locks but also object, tuple, extension, transaction and
advisory locks), and predicate locks (SIReadLock) which are limited by a
separate configuration parameter (and are not relevant in this case
based on the prior IRC discussion).
Peter> Filter by locktype = 'relation' to get the appropriate view.
This is incorrect (some predicate locks may be tagged 'relation' as
well, and some heavy locks will not be relation locks).
There's also the question of fastpath locks, but I believe there can
only be a small number of these (16?) per backend, so that wouldn't
account for this.
I think what's going on is that the max size of the lock hashtable isn't
strictly enforced; it'll add enough memory space for the configured
number of locks to the total size of the shared memory segment, but it
won't actually report an error until shared memory is actually
exhausted, and it's possible that there may be unused space.
(Performance may degrade if there are more locks than the configured
maximum, because the hash table will have been sized for that maximum
and can't be grown.) See comments for ShmemInitHash.
--
Andrew (irc:RhodiumToad)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: andrew@tao11.riddles.org.uk, peter.eisentraut@2ndquadrant.com, james.sewell@jirotech.com
Subject: Re: Max locks
In-Reply-To: <87immcbesb.fsf@news-spur.riddles.org.uk>
References: <CAANVwEvRv0ZKiZvVeFJu=_d2XzBwv+MhidzvUWF6L6+of_DBhw@mail.gmail.com> <ae27bd07-a93f-9274-849a-12dc35228745@2ndquadrant.com> <87immcbesb.fsf@news-spur.riddles.org.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox