Re: Parallel Inserts in CREATE TABLE AS

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Re: Parallel Inserts in CREATE TABLE AS
Дата
Msg-id CALj2ACVQeBrnwi8CAz=qx+YT-CUoL-eRnz0rxhNQy4_5FfhXwQ@mail.gmail.com
обсуждение исходный текст
Ответ на RE: Parallel Inserts in CREATE TABLE AS  ("Hou, Zhijie" <houzj.fnst@cn.fujitsu.com>)
Ответы RE: Parallel Inserts in CREATE TABLE AS
Список pgsql-hackers
On Thu, Nov 26, 2020 at 7:47 AM Hou, Zhijie <houzj.fnst@cn.fujitsu.com> wrote:
>
> Hi,
>
> I have an issue about the following code:
>
>         econtext = node->ps.ps_ExprContext;
>         ResetExprContext(econtext);
>
> +       if (ISCTAS(node->ps.intoclause))
> +       {
> +               ExecParallelInsertInCTAS(node);
> +               return NULL;
> +       }
>
>         /* If no projection is required, we're done. */
>         if (node->ps.ps_ProjInfo == NULL)
>                 return slot;
>
>         /*
>          * Form the result tuple using ExecProject(), and return it.
>          */
>         econtext->ecxt_outertuple = slot;
>         return ExecProject(node->ps.ps_ProjInfo);
>
> It seems the projection will be skipped.
> Is this because projection is not required in this case ?
> (I'm not very familiar with where the projection will be.)
>

For parallel inserts in CTAS, I don't think we need to project the
tuples being returned from the underlying plan nodes, and also we have
nothing to project from the Gather node further up. The required
projection will happen while the tuples are being returned from the
underlying nodes and the projected tuples are being directly fed to
CTAS's dest receiver intorel_receive(), from there into the created
table. We don't need ExecProject again in ExecParallelInsertInCTAS().

For instance, projection will always be done when the tuple is being
returned from an underlying sequential scan node(see ExecScan() -->
ExecProject() and this is true for both leader and workers. In both
leader and workers, we are just calling CTAS's dest receiver
intorel_receive().

Thoughts?

>
> If projection is not required here, shall we add some comments here?
>

If the above point looks okay, I can add a comment.

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Multi Inserts in CREATE TABLE AS - revived patch