Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msuQg-0007pg-RW for pgsql-performance@arkaria.postgresql.org; Thu, 02 Dec 2021 22:19:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1msuQZ-0001cd-PH for pgsql-performance@arkaria.postgresql.org; Thu, 02 Dec 2021 22:19:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msuQZ-0001cO-Eq for pgsql-performance@lists.postgresql.org; Thu, 02 Dec 2021 22:19:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msuQX-0000iU-79 for pgsql-performance@lists.postgresql.org; Thu, 02 Dec 2021 22:19:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1B2MJddI2225686; Thu, 2 Dec 2021 17:19:39 -0500 From: Tom Lane To: Ashkil Dighin cc: pgsql-performance@lists.postgresql.org Subject: Re: LwLockRelease performance In-reply-to: References: Comments: In-reply-to Ashkil Dighin message dated "Wed, 01 Dec 2021 19:56:11 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2225684.1638483579.1@sss.pgh.pa.us> Date: Thu, 02 Dec 2021 17:19:39 -0500 Message-ID: <2225685.1638483579@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ashkil Dighin writes: > The performance bottleneck in LWLockRelease()method goes through an array > one by one to see which lock was released with O(N). As soon as the lock is > found it performs an array to remove the lock. Typically, such locks are released in LIFO order. Do you have any actual evidence of a performance problem here? regards, tom lane