Re: Explain [Analyze] produces parallel scan for select Into table statements.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Explain [Analyze] produces parallel scan for select Into table statements.
Date: 2016-03-10 09:43:18
Message-ID: CAA4eK1JMgG_6vFLXVzVnmc0p1fb42NJU7mCzf6J-b-iXL0Uw7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 9, 2016 at 8:18 PM, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
wrote:
>
> Hi All,
>
> Explain [Analyze] Select Into table..... produces the plan which uses
parallel scans.
>
> Possible Fix:
>
> I tried to make a patch to fix this. Now in ExplainOneQuery if into
clause is
>
> defined then parallel plans are disabled as similar to their execution.
>

- /* plan the query */

- plan = pg_plan_query(query, CURSOR_OPT_PARALLEL_OK, params);

+ /*

+ * plan the query.

+ * Note: If Explain is for CreateTableAs / SelectInto Avoid parallel

+ * plans.

+ */

+ plan = pg_plan_query(query, into ? 0:CURSOR_OPT_PARALLEL_OK, params);

There should be a white space between 0:CURSOR_OPT_PARALLEL_OK. Also I
don't see this comment is required as similar other usage doesn't have any
such comment. Fixed these two points in the attached patch.

In general, the patch looks good to me and solves the problem mentioned. I
have ran the regression tests with force_parallel_mode and doesn't see any
problem.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
Analyze_select_into_disable_parallel_scan_v2.patch application/octet-stream 562 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2016-03-10 10:21:01 Re: Support for N synchronous standby servers - take 2
Previous Message Michael Paquier 2016-03-10 09:22:52 Re: Improving replay of XLOG_BTREE_VACUUM records