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 1pU2py-0001kV-Vj for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Feb 2023 09:51:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pU2px-0008AC-RT for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Feb 2023 09:51:57 +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 1pU2px-00089x-HX for pgsql-hackers@lists.postgresql.org; Mon, 20 Feb 2023 09:51:57 +0000 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pU2pv-00040r-DV for pgsql-hackers@lists.postgresql.org; Mon, 20 Feb 2023 09:51:56 +0000 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1720f8889b2so338184fac.7 for ; Mon, 20 Feb 2023 01:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XjEffs7DMtTUsl6uR0ofdR+RUI+8R//KLdNrhMcGX6M=; b=FkSwno+Rpz849boKMwF5XDI8+lrza3EqyvLfpbW+fm9rrNRC2pqW7QY3EVmGPhTeGs h2fVK6sOrHgEiBYMyMOzbMaZBkCsE6dPDorv5AFYLYALjiBxXFD2VH/1EG3dDUXFL7fS /X7hHOG+xhBdYa9Z88RDvsyuk1CdspngW4hdQSSVx1DK7q3K5FZQogQmSchzkg5DV8g/ 3oFmQOpyqBL4imwvHKbjePTZp9yoxxmJ4vDSzzVF7RmMPOkCNqB8G6ENyTrKUZ2OXd4N RtkCsmVxqVK2LO8ZqTJ803LBu9e4fukw99cEm58gDc/0iD84P8U2PDtngG8OaCSyKAH0 tuYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XjEffs7DMtTUsl6uR0ofdR+RUI+8R//KLdNrhMcGX6M=; b=AdUetx8RErN/FiuUSx9GBiFsbNWwztXJK/eLhjSqS0us2FNIyoYQIForbXovYdZre4 p7Bwq8FFByz9PlnIERwFODkiqiGKMftsuES2gBY5DhBA+4NEGznfBPmrLaElhkJ45las B9WMMBJxpXrZYupUZUZxMfBmrayapBAjr7yPl6ZklgFpd+uS7fOBBM9QBO5WNQh+EKT0 HX0u/tclz9Bo2hbpynPTT4/Jn6qD6ije0BZyO0ESCZcUZGFnRftoDjiBXURYJqW4ayeh PwSvvkvfiBZXCk2zg80hm8Fcpul48wytA4n/juvMXzMnEfj0yiehZJy+LxlDtaDiJyOA 0w6g== X-Gm-Message-State: AO0yUKXyAR6x8ATMzPKxHXCvDfG3DGMc5pF2nwfO1BbdqyPZNehYWgLn ow2uiopwDQQ7bR+SycGW6PpsDMbkTgLgql0gaQXh3YaV X-Google-Smtp-Source: AK7set+CmBovRrVRybDRuaMbGAny3pQvLm3C9vY4xCntmVIvHfvTjYPQpvJ2BBMkIGWzMon/2UHgVqC5HVwufbHAxpo= X-Received: by 2002:a05:6870:524:b0:171:e79f:e6c0 with SMTP id j36-20020a056870052400b00171e79fe6c0mr223186oao.124.1676886714605; Mon, 20 Feb 2023 01:51:54 -0800 (PST) MIME-Version: 1.0 References: <20230217002351.nyt4y5tdzg6hugdt@awork3.anarazel.de> In-Reply-To: From: David Rowley Date: Mon, 20 Feb 2023 22:51:40 +1300 Message-ID: Subject: Re: Introduce list_reverse() to make lcons() usage less inefficient To: Andres Freund Cc: PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 17 Feb 2023 at 16:35, David Rowley wrote: > > On Fri, 17 Feb 2023 at 13:23, Andres Freund wrote: > > But wouldn't an even cheaper way here be to iterate over the children in > > reverse order when match_partition_order_desc? We can do that efficiently > > now. Looks like we don't have a readymade helper for it, but it'd be easy > > enough to add or open code. > > That seems fair. I think open coding is a better option. I had a go > at foreach_reverse recently and decided to keep clear of it due to > behavioural differences with foreach_delete_current(). I've pushed a patch for this now. Thank you for the idea. David