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 1hsb38-0007Gj-Ao for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jul 2019 22:56:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hsb37-00088J-3v for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jul 2019 22:56:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsb36-00088C-P0 for pgsql-hackers@lists.postgresql.org; Tue, 30 Jul 2019 22:56:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hsb34-0002bB-F1 for pgsql-hackers@lists.postgresql.org; Tue, 30 Jul 2019 22:56:51 +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 x6UMulol008057; Tue, 30 Jul 2019 18:56:47 -0400 From: Tom Lane To: David Rowley cc: Amit Langote , Yuzuko Hosoya , PostgreSQL Hackers Subject: Re: Runtime pruning problem In-reply-to: <7814.1564527032@sss.pgh.pa.us> References: <001001d4f44b$2a2cca50$7e865ef0$@lab.ntt.co.jp> <2018.1555473241@sss.pgh.pa.us> <2923.1555474214@sss.pgh.pa.us> <17368.1555608352@sss.pgh.pa.us> <6779.1564525639@sss.pgh.pa.us> <7814.1564527032@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 30 Jul 2019 18:50:32 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8055.1564527407.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 30 Jul 2019 18:56:47 -0400 Message-ID: <8056.1564527407@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > This may be arguing for a change in ruleutils' existing behavior, > not sure. But when dealing with traditional-style inheritance, > I've always thought that Vars above the Append were referring to > the parent rel in its capacity as the parent, not in its capacity > as the first child. With new-style partitioning drawing a clear > distinction between the parent and all its children, it's easier > to understand the difference. OK, so experimenting, I see that it is a change: HEAD does regression=3D# explain verbose select * from part order by a; QUERY PLAN = = --------------------------------------------------------------------------= ------- Sort (cost=3D362.21..373.51 rows=3D4520 width=3D8) Output: part_p1.a, part_p1.b Sort Key: part_p1.a -> Append (cost=3D0.00..87.80 rows=3D4520 width=3D8) -> Seq Scan on public.part_p1 (cost=3D0.00..32.60 rows=3D2260 w= idth=3D8) Output: part_p1.a, part_p1.b -> Seq Scan on public.part_p2_p1 (cost=3D0.00..32.60 rows=3D226= 0 width=3D8) Output: part_p2_p1.a, part_p2_p1.b (8 rows) The portion of this below the Append is fine, but I argue that the Vars above the Append should say "part", not "part_p1". In that way they'd look the same regardless of which partitions have been pruned or not. regards, tom lane