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 1hGbtz-0007ab-Gf for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Apr 2019 04:10:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGbty-0003vT-0T for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Apr 2019 04:10:26 +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 1hGbtx-0003vM-O6 for pgsql-hackers@lists.postgresql.org; Wed, 17 Apr 2019 04:10:25 +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 1hGbtr-0001Ho-Dw for pgsql-hackers@lists.postgresql.org; Wed, 17 Apr 2019 04:10:25 +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 x3H4AEx6002924; Wed, 17 Apr 2019 00:10:14 -0400 From: Tom Lane To: David Rowley cc: Amit Langote , Yuzuko Hosoya , PostgreSQL Hackers Subject: Re: Runtime pruning problem In-reply-to: References: <001001d4f44b$2a2cca50$7e865ef0$@lab.ntt.co.jp> <2018.1555473241@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Wed, 17 Apr 2019 15:58:52 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2922.1555474214.1@sss.pgh.pa.us> Date: Wed, 17 Apr 2019 00:10:14 -0400 Message-ID: <2923.1555474214@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley writes: > On Wed, 17 Apr 2019 at 15:54, Tom Lane wrote: >> What I'm more worried about is whether this breaks any internal behavior >> of explain.c, as the comment David quoted upthread seems to think. >> If we need to have a tlist to reference, can we make that code look >> to the pre-pruning plan tree, rather than the planstate tree? > I think most of the complexity is in what to do in > set_deparse_planstate() given that there might be no outer plan to > choose from for Append and MergeAppend. This controls what's done in > resolve_special_varno() as this descends the plan tree down the outer > side until it gets to the node that the outer var came from. > We wouldn't need to do this if we just didn't show the targetlist in > EXPLAIN VERBOSE, but there's also MergeAppend sort keys to worry about > too. Should we just skip on those as well? No, the larger issue is that *any* plan node above the Append might be recursing down to/through the Append to find out what to print for a Var reference. We have to be able to support that. regards, tom lane