Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSNmP-0003nD-FM for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Jun 2018 14:26:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSNmO-0002NY-9I for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Jun 2018 14:26:44 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSNmO-0002NP-2a for pgsql-hackers@lists.postgresql.org; Mon, 11 Jun 2018 14:26:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSNmL-0004aZ-HE for pgsql-hackers@lists.postgresql.org; Mon, 11 Jun 2018 14:26:43 +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 w5BEQWKm000557; Mon, 11 Jun 2018 10:26:32 -0400 From: Tom Lane To: David Rowley cc: Amit Langote , Dmitry Dolgov <9erthalion6@gmail.com>, Jeff Janes , Ashutosh Bapat , Pavel Stehule , PostgreSQL Hackers Subject: Re: why partition pruning doesn't work? In-reply-to: References: <7142.1527868419@sss.pgh.pa.us> <1111.1527977170@sss.pgh.pa.us> <10432.1528045900@sss.pgh.pa.us> <569483c5-a273-6537-1b5d-7a271ce439fb@lab.ntt.co.jp> <22805.1528386192@sss.pgh.pa.us> <21787.1528428171@sss.pgh.pa.us> <6366.1528571895@s! ss.pgh.pa.us> <12624.1528578026@sss.pgh.pa.us> <26279.1528670981@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Mon, 11 Jun 2018 13:55:33 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <555.1528727192.1@sss.pgh.pa.us> Date: Mon, 11 Jun 2018 10:26:32 -0400 Message-ID: <556.1528727192@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley writes: > On 11 June 2018 at 10:49, Tom Lane wrote: >> * The business with ExecFindInitialMatchingSubPlans remapping the >> subplan indexes seems very dubious to me. Surely, that is adding >> way more complexity and fragility than it's worth. > I think having the ability to prune during executor initialisation is > enormously important. I think without it, this patch is less than half > as useful. Sure. > However, if you didn't mean removing the executor > initialise pruning, and just not remapping the arrays, then I'm not > sure how we'd do that. I'd previously tried having NULL subnodes in > the Append and I thought it required too much hacking work in > explain.c, so I decided to just collapse the array instead and do what > was required to make it work after having removed the unneeded > subplans. Did you have another idea on how to do this? No, that was pretty much exactly what I was envisioning. I have not looked at the consequences for explain.c but it seemed like it couldn't be all that bad; and to my mind the remapping business in the partition code is pretty bad. "It's all in one file" is not a suitable justification for unintelligible, overcomplex code. regards, tom lane