Re: scan on inheritance parent with no children in current session

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: scan on inheritance parent with no children in current session
Date: 2017-08-11 15:38:27
Message-ID: CA+Tgmoa3HvDNuj292uuMP4if24Nm7dzWEKY_=wPm_uhD5n-cZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 6, 2017 at 10:56 PM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Good catch. I agree that getting an Append node after that commit is
> unintentional and we should fix so that we don't get an Append. So, +1 to
> your patch. I looked at the patch and the code fix seems to do what we want.

So, I also agree that this is a good fix, but I don't think it fixes
the whole problem. Consider:

rhaas=# create table parent (a int) partition by list (a);
CREATE TABLE
rhaas=# create temp table child partition of parent for values in (1);
CREATE TABLE
rhaas=# explain verbose select * from parent;
QUERY PLAN
-------------------------------------------------------------------------
Append (cost=0.00..35.50 rows=2550 width=4)
-> Seq Scan on pg_temp_3.child (cost=0.00..35.50 rows=2550 width=4)
Output: child.a
(3 rows)

But the comments say:

* A childless table is never considered to be an inheritance set; therefore
* a parent RTE must always have at least two associated AppendRelInfos.

Yet, not. So at least the comments need to be updated; not sure if we
want to try to eliminate the Append node in this case also.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-08-11 15:42:13 Re: Patches I'm thinking of pushing shortly
Previous Message Adam, Etienne (Nokia-TECH/Issy Les Moulineaux) 2017-08-11 15:33:22 [postgresql 10 beta3] unrecognized node type: 90