Re: Parallel Inserts in CREATE TABLE AS

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, Luc Vlaming <luc(at)swarm64(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel Inserts in CREATE TABLE AS
Date: 2021-01-06 06:01:05
Message-ID: CAFiTN-ug=adewGH1gtFeLu5Fa4N+dX+FHrvMm--uWaDiLK8LQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 6, 2021 at 11:26 AM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Wed, Jan 6, 2021 at 10:17 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> >
> > On Wed, Jan 6, 2021 at 9:23 AM Bharath Rupireddy
> > <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > >
> >
> > +/*
> > + * List the commands here for which parallel insertions are possible.
> > + */
> > +typedef enum ParallelInsertCmdKind
> > +{
> > + PARALLEL_INSERT_CMD_UNDEF = 0,
> > + PARALLEL_INSERT_CMD_CREATE_TABLE_AS
> > +} ParallelInsertCmdKind;
> >
> > I see there is some code that is generic for CTAS and INSERT INTO
> > SELECT *, So is it
> > possible to take out that common code to a separate base patch? Later
> > both CTAS and INSERT INTO SELECT * can expand
> > that for their usage.
>
> I currently see the common code for parallel inserts i.e. insert into
> selects, copy, ctas/create mat view/refresh mat view is the code in -
> heapam.c, xact.c and xact.h. I can make a separate patch if required
> for these changes alone. Thoughts?

I just saw this structure (ParallelInsertCmdKind) where it is defining
the ParallelInsertCmdKind and also usage is different based on the
command type. So I think the code which is defining the generic code
e.g. this structure and other similar code can go to the first patch
and we can build the remaining patch atop that patch. But if you
think this is just this structure and not much code is common then we
can let it be.

> IIRC parallel inserts in insert into select and copy don't use the
> design idea of pushing the dest receiver down to Gather. Whereas
> ctas/create mat view, refresh mat view, copy to can use the idea of
> pushing the dest receiver to Gather and can easily extend on the
> patches I made here.
>
> Is there anything else do you feel that we can have in common?

Nothing specific.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2021-01-06 06:28:36 Re: Spurious "apparent wraparound" via SimpleLruTruncate() rounding
Previous Message Hou, Zhijie 2021-01-06 06:00:06 RE: Parallel Inserts in CREATE TABLE AS