Re: scan on inheritance parent with no children in current session
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-08-07T02:56:32Z
Lists: pgsql-hackers
On 2017/08/04 18:11, Ashutosh Bapat wrote: > After that commit in session 1, we get an Append plan > postgres=# explain verbose select * from parent; > QUERY PLAN > ------------------------------------------------------------------- > Append (cost=0.00..0.00 rows=1 width=4) > -> Seq Scan on public.parent (cost=0.00..0.00 rows=1 width=4) > Output: parent.a > (3 rows) > > I don't think this is an intentional change. Here's patch to fix it. > The comment in the patch uses term "real child" in the context of > comments about temporary children from other session and the comment > at the end of the function where rte->inh is reset. May be we should > move the second comment before setting has_child in the patch and use > "real child" in the comment at the end to avoid repetition. But I want > to first check whether we want this fix or we can live with the Append > plan. 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. Thanks, Amit
Commits
-
Avoid unnecessary single-child Append nodes.
- 17a2a27b49ae 10.0 landed
- d57929afc706 11.0 landed
-
Don't scan partitioned tables.
- d3cc37f1d801 10.0 cited