pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: bossartn@amazon.com, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: michael@paquier.xyz
Cc: sulamul@gmail.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: inefficient loop in StandbyReleaseLockList()
Date: Sat, 06 Nov 2021 19:13:31 -0400
Message-ID: <641260.1636240411@sss.pgh.pa.us> (raw)
In-Reply-To: <20211106224648.wcmavq6ngv43ysb7@alap3.anarazel.de>
References: <C84534A6-2E66-47FF-B193-EBB566544D49@amazon.com>
	<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>
	<588672.1636221972@sss.pgh.pa.us>
	<20211106222251.msmjshfhvcvy3lpd@alap3.anarazel.de>
	<613307.1636237974@sss.pgh.pa.us>
	<20211106224648.wcmavq6ngv43ysb7@alap3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> On 2021-11-06 18:32:54 -0400, Tom Lane wrote:
>> Good point.  The note at list_delete_last that it's O(1) isn't really
>> on point --- instead, the text for list_delete_first should be like
>> 
>> + * Note that this takes time proportional to the length of the list,
>> + * since the remaining entries must be moved.  Consider reversing the
>> + * list order so that you can use list_delete_last() instead.  However,
>> + * if that causes you to replace lappend() with lcons(), you haven't
>> + * improved matters.

> LGTM

Done that way, then.

			regards, tom lane





view thread (41+ messages)

Message-ID: <641260.1636240411@sss.pgh.pa.us>
Permalink:  ../641260.1636240411@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/641260.1636240411@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, horikyota.ntt@gmail.com, michael@paquier.xyz, sulamul@gmail.com
  Subject: Re: inefficient loop in StandbyReleaseLockList()
  In-Reply-To: <641260.1636240411@sss.pgh.pa.us>

* 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