Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihweE-0002bW-36 for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 14:19:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihweB-00063T-5w for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 14:19:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihweA-00063K-Om for pgsql-general@lists.postgresql.org; Thu, 19 Dec 2019 14:19:22 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ihwe3-0003YX-L4 for pgsql-general@lists.postgresql.org; Thu, 19 Dec 2019 14:19:21 +0000 Received: from [192.168.127.1] (port=43420 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1ihwdx-0002te-FB; Thu, 19 Dec 2019 14:19:09 +0000 Received: from localhost ([127.0.0.1]:22510 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1ihwdw-0001GT-Fo; Thu, 19 Dec 2019 14:19:08 +0000 From: Andrew Gierth To: Peter Eisentraut Cc: James Sewell , "pgsql-generallists.postgresql.org" Subject: Re: Max locks In-Reply-To: (Peter Eisentraut's message of "Thu, 19 Dec 2019 13:02:44 +0100") Message-ID: <87immcbesb.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) Date: Thu, 19 Dec 2019 14:19:08 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Peter" == Peter Eisentraut 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)