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

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: [HACKERS] scan on inheritance parent with no children in current session
Дата
Msg-id CAFjFpRfwawadtQNbwZ8FJ+-my1J4fx1adwh7AQRZ-CtNKO4Ypg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] scan on inheritance parent with no children in current session  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] scan on inheritance parent with no children in current session
Список pgsql-hackers
On Fri, Aug 11, 2017 at 9:08 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>
> 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;

A partitioned table with at least a single partition is not childless.
So, above comment doesn't apply here. In a regular inheritance there
will be at least two AppendRelInfos one representing a scan on the
parent table and others representing the scan on children. The comment
needs to be distinguish between regular inheritance and partitioned
inheritance. I have modified the comments that way.

> not sure if we
> want to try to eliminate the Append node in this case also.
>

The rest of the query tree and plan tree, expects parent's targetlist
which may be different from that of the child. A notable difference is
whole row expressions getting translated using ConvertRowExpr, which
are not expected to pop up in a scan's targetlist. So we can't
eliminate the Append node.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Rushabh Lathia
Дата:
Сообщение: Re: [HACKERS] reload-through-the-top-parent switch the partition table
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Regressions failures with libxml2 on ArchLinux