RE: Parallel INSERT (INTO ... SELECT ...) - Mailing list pgsql-hackers

From Hou, Zhijie
Subject RE: Parallel INSERT (INTO ... SELECT ...)
Date
Msg-id 7a08d98a4ea34373af86c7e022f4af82@G08CNEXMBPEKD05.g08.fujitsu.local
Whole thread Raw
In response to Re: Parallel INSERT (INTO ... SELECT ...)  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Parallel INSERT (INTO ... SELECT ...)
List pgsql-hackers
Hi

> > I may be wrong, and if I miss sth in previous mails, please give me some
> hints.
> > IMO, serial insertion with underlying parallel SELECT can be
> > considered for foreign table or temporary table, as the insertions only
> happened in the leader process.
> >
> 
> I don't think we support parallel scan for temporary tables. Can you please
> try once both of these operations without Insert being involved? If you
> are able to produce a parallel plan without Insert then we can see why it
> is not supported with Insert.

Sorry, may be I did not express it clearly, I actually means the case when insert's target(not in select part) table is
temporary.
And you are right that parallel select is not enabled when temporary table is in select part.

I test for the case when insert's target table is temporary or not.
--insert into not temporary table---
postgres=# explain (costs off) insert into notemp select * from test where i < 600;
              QUERY PLAN               
---------------------------------------
 Gather
   Workers Planned: 4
   ->  Insert on notemp
         ->  Parallel Seq Scan on test
               Filter: (i < 600)

--insert into temporary table---
postgres=# explain (costs off) insert into temp select * from test where i < 600;
       QUERY PLAN         
---------------------------
 Insert on temp
   ->  Seq Scan on test
         Filter: (i < 600)

---without insert part---
postgres=# explain (costs off) select * from test where i < 600;
           QUERY PLAN            
---------------------------------
 Gather
   Workers Planned: 4
   ->  Parallel Seq Scan on test
         Filter: (i < 600)

Best regards,
houzj



pgsql-hackers by date:

Previous
From: Li Japin
Date:
Subject: Re: Confused about stream replication protocol documentation
Next
From: Amit Kapila
Date:
Subject: Re: Parallel INSERT (INTO ... SELECT ...)