Re: Parallel Inserts in CREATE TABLE AS
От | Bharath Rupireddy |
---|---|
Тема | Re: Parallel Inserts in CREATE TABLE AS |
Дата | |
Msg-id | CALj2ACU4G55XEC9kN=-g5uEXm7gtXYBo2mgPucoXRPEJeUCOmA@mail.gmail.com обсуждение исходный текст |
Ответ на | RE: Parallel Inserts in CREATE TABLE AS ("Hou, Zhijie" <houzj.fnst@cn.fujitsu.com>) |
Список | pgsql-hackers |
On Fri, Nov 27, 2020 at 11:57 AM Hou, Zhijie <houzj.fnst@cn.fujitsu.com> wrote: > > > Thanks a lot for the use case. Yes with the current patch table will lose > > data related to the subplan. On analyzing further, I think we can not allow > > parallel inserts in the cases when the Gather node has some projections > > to do. Because the workers can not perform that projection. So, having > > ps_ProjInfo in the Gather node is an indication for us to disable parallel > > inserts and only the leader can do the insertions after the Gather node > > does the required projections. > > > > Thoughts? > > > > Agreed. > Thanks! I will add/modify IsParallelInsertInCTASAllowed() to return false in this case. > > 2. > @@ -166,6 +228,16 @@ ExecGather(PlanState *pstate) > { > ParallelContext *pcxt; > > + /* > + * Take the necessary information to be passed to workers for > + * parallel inserts in CTAS. > + */ > + if (ISCTAS(node->ps.intoclause)) > + { > + node->ps.lefttree->intoclause = node->ps.intoclause; > + node->ps.lefttree->objectid = node->ps.objectid; > + } > + > /* Initialize, or re-initialize, shared state needed by workers. */ > if (!node->pei) > node->pei = ExecInitParallelPlan(node->ps.lefttree, > > I found the code pass intoclause and objectid to Gather node's lefttree. > Is it necessary? It seems only Gather node will use the information. > I am passing the required information from the up to here through PlanState structure. Since the Gather node's leftree is also a PlanState structure variable, here I just assigned them to pass that information to ExecInitParallelPlan(). With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: