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 1p18C8-0000tf-MD for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Dec 2022 15:43:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p18C7-0002i2-5u for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Dec 2022 15:43:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p18C6-0002hs-T5 for pgsql-hackers@lists.postgresql.org; Fri, 02 Dec 2022 15:43:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p18C0-0001l5-I9 for pgsql-hackers@lists.postgresql.org; Fri, 02 Dec 2022 15:43:18 +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 2B2FhAZr1935227; Fri, 2 Dec 2022 10:43:10 -0500 From: Tom Lane To: Ashutosh Bapat cc: pgsql-hackers@lists.postgresql.org Subject: Re: Missing MaterialPath support in reparameterize_path_by_child In-reply-to: References: <1854233.1669949723@sss.pgh.pa.us> Comments: In-reply-to Ashutosh Bapat message dated "Fri, 02 Dec 2022 16:51:27 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1935225.1669995790.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 02 Dec 2022 10:43:10 -0500 Message-ID: <1935226.1669995790@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ashutosh Bapat writes: > On Fri, Dec 2, 2022 at 8:25 AM Tom Lane wrote: >> Unfortunately, I don't have an example that produces such a >> failure against HEAD. It seems certain to me that such cases >> exist, though, so I'd like to apply and back-patch the attached. > From this comment, that I wrote back when I implemented that function, > I wonder if we thought MaterialPath wouldn't appear on the inner side > of nestloop join. But that can't be the case. Or probably we didn't > find MaterialPath being there from our tests. > * This function is currently only applied to the inner side of a ne= stloop > * join that is being partitioned by the partitionwise-join code. H= ence, > * we need only support path types that plausibly arise in that cont= ext. > But I think it's good to have MaterialPath there. So thinking about this a bit: the reason it is okay if reparameterize_path fails is that it's not fatal. We just go on our way without making a parameterized path for that appendrel. However, if reparameterize_path_by_child fails for every available child path, we end up with "could not devise a query plan", because the partitionwise-join code is brittle and won't tolerate failure to build a parent-join path. Seems like we should be willing to fall back to a non-partitionwise join in that case. regards, tom lane