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 1gyNuf-00064P-9p for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Feb 2019 21:35:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gyNud-0001mX-6S for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Feb 2019 21:35:47 +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 1gyNuc-0001lc-SM for pgsql-hackers@lists.postgresql.org; Mon, 25 Feb 2019 21:35:47 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyNuY-0002I5-Pv for pgsql-hackers@lists.postgresql.org; Mon, 25 Feb 2019 21:35:45 +0000 Received: by mail-wr1-x432.google.com with SMTP id o17so11616130wrw.3 for ; Mon, 25 Feb 2019 13:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WAZsSFJPdnIqSLzrBl8AiZWiPkpvrU6M+K8ndXRnjA4=; b=YXY2J+EEoQnMy017PGwmHTfKbAVTbr1nDkpQvC9EqP353C2emQPUY02z1QYDDLVioC BbtMUId+lhaeradwUIKxQv/RjTYsFnEn5AkmQPlW+sbWL68Of8Jv7w4vP5zR62qfwMhA dU3DpH2L+Oxsv+jdFvqD/g3iTxBVAw8l9Xm1wFXCxcYZppesbUTmpxVYwIiW4ygbop06 EK8U+f0owK7loHmPDmrKye6ZLpf9A+/pnmKyEkPnU5dL5KppEs+CEM8t17S87YtXgNUN ZNi0/9QPule/PsFKfmzk1Q8FxUS7wn0JZvGcMGx+CAHIF8rIZ5t7QnSr8bcEHKFfgzhs QBEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WAZsSFJPdnIqSLzrBl8AiZWiPkpvrU6M+K8ndXRnjA4=; b=YU1UcmDeamxYP9xUdRKRpazCtXe0CHKE527BRfgYrlX9doZw3Kjnb2pBLAaD29H7pm z7uzAQOb1VmJvMrUgghPWN7dOIRo2Le1MtFvsiUjOsWKLB5joh9KYBYnBUpPqfJrB4Br 8SnXid1/jKUlTAHFTCixL59t1yn+4BYm/5EzMjJl0gQUKW1erdD+2VgY+ttTdHorNTN9 tBeQlfOmXDIBrA/CEKiz5JpBwSNduVrS9gfPzwOBPVccgnog6UtlYSZwEngv5UpOQ4xp jyPjPP06WX4jk5T0ONSUnshe/lxoied7Vtz+lezdk5MgDNP+gn9aTcpRUR1H0oYd4ILK x0kA== X-Gm-Message-State: AHQUAubydrneFGHJi/E2s1JKi0T0IGEjiQ9raX/18dPM+gR2qak1eBS0 qtyTO99VerRh9lE/2UdNTY/o1B2HTJBmK+UinG3lUWQfeoAmA1dfrWTCRvsAbcJEUkdnC+kFQco 2FrUfht2vevu4qQ9NFis7QJmGqP9zXaMBYFC8lQba7PbEaE6dE5TapAh043AvckalFe1z4/9wIB vma4lx0hfUHgVkx3qxWTY= X-Google-Smtp-Source: AHgI3IZBC6R8qgpTBHHpiSHJ65KKK5oyasW+fombgAPhsmKe4sUJAbNELFsg7B6iAR4mtgwndkBIYA== X-Received: by 2002:a5d:53c2:: with SMTP id a2mr13512186wrw.244.1551130540709; Mon, 25 Feb 2019 13:35:40 -0800 (PST) Received: from [10.137.0.18] ([62.168.16.220]) by smtp.gmail.com with ESMTPSA id z198sm405096wmc.10.2019.02.25.13.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 13:35:40 -0800 (PST) Subject: Re: POC: converting Lists into arrays To: Andres Freund , Peter Geoghegan Cc: Tom Lane , Robert Haas , PostgreSQL Hackers References: <11587.1550975080@sss.pgh.pa.us> <1325.1551118646@sss.pgh.pa.us> <2320.1551121176@sss.pgh.pa.us> <20190225210344.26nf25wro3qt4q3o@alap3.anarazel.de> From: Tomas Vondra Message-ID: <3ccc28fb-a07c-3412-d48c-cc46de1ae42b@2ndquadrant.com> Date: Mon, 25 Feb 2019 22:35:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190225210344.26nf25wro3qt4q3o@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/25/19 10:03 PM, Andres Freund wrote: > Hi, > > On 2019-02-25 11:59:06 -0800, Peter Geoghegan wrote: >> On Mon, Feb 25, 2019 at 10:59 AM Tom Lane wrote: >>> Because it involves touching ten times more code (and that's a very >>> conservative estimate). Excluding changes in pg_list.h + list.c, >>> what I posted touches approximately 600 lines of code (520 insertions, >>> 644 deletions to be exact). For comparison's sake, there are about >>> 1800 uses of foreach in the tree, each of which would require at least >>> 3 changes to replace (the foreach itself, the ListCell variable >>> declaration, and at least one lfirst() reference in the loop body). >> >> If we knew that the list code was the bottleneck in a handful of >> cases, then I'd come down on Robert's side here. It would then be >> possible to update the relevant bottlenecked code in an isolated >> fashion, while getting the lion's share of the benefit. However, I >> don't think that that's actually possible. The costs of using Lists >> everywhere are real and measurable, but it's also highly distributed. >> At least, that's my recollection from previous discussion from several >> years back. I remember talking about this with Andres in early 2016. > > It's distributed, but not *that* distributed. The largest source of > "cost" at execution time used to be all-over expression evaluation, but > that's gone now. That was a lot of places, but it's not outside of reach > of a targeted change. Now it's targetlist handling, which'd have to > change together with plan time, where it's a large issue. > So let's say we want to measure the improvement this patch gives us. What would be some reasonable (and corner) cases to benchmark? I do have some ideas, but as you've been looking at this in the past, perhaps you have something better. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services