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 1mipGR-0000NX-0C for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Nov 2021 02:47:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mipGO-0002pe-FC for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Nov 2021 02:47:32 +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 1mipGO-0002pU-6v for pgsql-hackers@lists.postgresql.org; Fri, 05 Nov 2021 02:47:32 +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 1mipGL-0001xB-VL for pgsql-hackers@postgresql.org; Fri, 05 Nov 2021 02:47:31 +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 1A52lN81373297; Thu, 4 Nov 2021 22:47:23 -0400 From: Tom Lane To: Michael Paquier cc: Andres Freund , bossartn@amazon.com, Kyotaro Horiguchi , sulamul@gmail.com, pgsql-hackers@postgresql.org Subject: Re: inefficient loop in StandbyReleaseLockList() In-reply-to: References: <1138901.1635782315@sss.pgh.pa.us> <1311319.1635804078@sss.pgh.pa.us> <20211102.114313.713245704579079227.horikyota.ntt@gmail.com> <1376384.1635862908@sss.pgh.pa.us> <1512317.1635867355@sss.pgh.pa.us> <20211104221248.pgo4h6wvnjl6uvkb@alap3.anarazel.de> <364794.1636071716@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Fri, 05 Nov 2021 11:40:00 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <373295.1636080443.1@sss.pgh.pa.us> Date: Thu, 04 Nov 2021 22:47:23 -0400 Message-ID: <373296.1636080443@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > On Thu, Nov 04, 2021 at 08:21:56PM -0400, Tom Lane wrote: >> Hm. I think it's not the only list function with O(N) behavior; >> in fact there used to be more such functions than there are now. >> But I could get behind a patch that annotates all of them. > Documenting that makes sense. Shouldn't we be careful to do that in > both pg_list.h and list.c, then? We have seldom, if ever, put function API-definition comments into .h files. I do not see a reason why this case deserves an exception. (It's tough enough to get people to maintain definition comments that are right beside the code they describe --- I think putting them in .h files would be a disaster.) regards, tom lane