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 1hnlJl-0002hu-8d for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jul 2019 14:54:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnlJj-0003Jm-9M for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jul 2019 14:54:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnlJj-0003Je-0v for pgsql-hackers@lists.postgresql.org; Wed, 17 Jul 2019 14:54:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnlJg-0002B5-Hp for pgsql-hackers@lists.postgresql.org; Wed, 17 Jul 2019 14:54:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6HErrex019397; Wed, 17 Jul 2019 10:53:53 -0400 From: Tom Lane To: Daniel Gustafsson cc: David Rowley , Jesper Pedersen , Andres Freund , Robert Haas , PostgreSQL Hackers Subject: Re: POC: converting Lists into arrays In-reply-to: <3C77817B-959F-4D70-ABB1-97FFA478F1AE@yesql.se> References: <481.1551390571@sss.pgh.pa.us> <24783.1551568303@sss.pgh.pa.us> <20190303043424.itzy3ge52xrkpmpr@alap3.anarazel.de> <437.1551637744@sss.pgh.pa.us> <12684.1551723095@sss.pgh.pa.us> <20190304190612.vgqqsowzkrh22623@alap3.anarazel.de> <26464.1551734920@sss.pgh.pa.us> <20190304221101.hdg4vj5fo4eewh3b@alap3.anarazel.de> <20190304235402.nod3gbotk2qtd4nh@alap3.anarazel.de> <1131.1551746172@sss.pgh.pa.us> <14626.1558745627@sss.pgh.pa.us> <29297.1558799327@sss.pgh.pa.us> <25178.1562006685@sss.pgh.pa.us> <25258.1562023641@sss.pgh.pa.us> <2305.1562181615@sss.pgh.pa.us> <21272.1563318411@sss.pgh.pa.us> <3C77817B-959F-4D70-ABB1-97FFA478F1AE@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Wed, 17 Jul 2019 16:12:28 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <19395.1563375233.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 17 Jul 2019 10:53:53 -0400 Message-ID: <19396.1563375233@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Daniel Gustafsson writes: > For cases where an Oid list is copied and then head elements immediately > removed, as in fetch_search_path, couldn=E2=80=99t we instead use a coun= ter and > list_copy_tail to avoid repeated list_delete_first calls? Perhaps, but I'm having a hard time getting excited about it. I don't think there's any evidence that fetch_search_path is a performance issue. Also, this coding requires that the *only* changes be deletion of head elements, whereas as it stands, once we've copied the list we can do what we like. > Since we=E2=80=99ve allowed list_delete_first on NIL for a long time, it= seems > reasonable to do the same for list_delete_last even though it=E2=80=99s = hard to come up > with a good usecase for deleting the last element without inspecting the= list > (a stack growing from the bottom perhaps? Yeah, I intentionally made the edge cases the same. There's room to argue that both functions should error out on NIL, instead. I've not looked into that though, and would consider it material for a separate patch. > Looking mainly at 0001 for now, I agree that the order is insignificant. Thanks for looking! regards, tom lane