Re: Parallel query only when EXPLAIN ANALYZEd

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jay Knight <jay(at)jayknight(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Parallel query only when EXPLAIN ANALYZEd
Date: 2016-09-30 21:52:44
Message-ID: CAKJS1f8Ca6=Jj83Bb7EWaSKwcS=uGVGWEAf8o7uwQSH7pX6a4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1 October 2016 at 10:10, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
>> On 1 October 2016 at 05:47, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Somebody will need to trace through this on Windows and see where it's
>>> going off the rails.
>
>> I tried the test case on 9.6.0 on a Windows 8.1 machine, and it works
>> fine for me.
>
> Hm, but if we assume that EXPLAIN ANALYZE is somehow affecting the
> behavior, it's entirely plausible that having auto_explain active
> would have the same effect.
>
> Please try it without auto_explain, and just rely on noting the runtime
> with psql's \timing to infer whether workers were active or not.

It's certainly worth trying that, but in Jay's case auto_explain made
no difference.

Results without auto_explain:

postgres=# set max_parallel_workers_per_gather=8;
SET
Time: 0.257 ms
postgres=# SELECT avg(id) from big where id % 17 = 0;
avg
-----------------------
15000001.000000000000
(1 row)

Time: 1027.599 ms (00:01.028)
postgres=# set max_parallel_workers_per_gather=0;
SET
Time: 0.163 ms
postgres=# SELECT avg(id) from big where id % 17 = 0;
avg
-----------------------
15000001.000000000000
(1 row)

Time: 3262.519 ms (00:03.263)

postgres=# select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.0 on x86_64-pc-mingw64, compiled by gcc.exe (Rev5,
Built by MSYS2 project) 4.9.2, 64-bit
(1 row)

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message raf 2016-09-30 22:56:25 Re: Frequent "pg_ctl status" removing(?) semaphores (unlikely)
Previous Message Tom Lane 2016-09-30 21:15:38 Re: pgadmin vs psql output