Re: Parallel query only when EXPLAIN ANALYZEd - Mailing list pgsql-general

From David Rowley
Subject Re: Parallel query only when EXPLAIN ANALYZEd
Date
Msg-id CAKJS1f9GzQ1QJj7kyQq8N7W39aV7fjySsKEn0FBJzHtMDZLqeQ@mail.gmail.com
Whole thread Raw
In response to Parallel query only when EXPLAIN ANALYZEd  (Jay Knight <jay@jayknight.com>)
Responses Re: Parallel query only when EXPLAIN ANALYZEd  (Jay Knight <jay@jayknight.com>)
List pgsql-general
On 30 September 2016 at 08:52, Jay Knight <jay@jayknight.com> wrote:
> So, why might postgres parallelize the query when I explain analyze it, but
> not when I just run it by itself?

One theory would be that, the worker might not have been available
when you performed the query execution, but it just happened to be
when you did the EXPLAIN ANALYZE. If the executor can't get a free
worker process, then it'll just do all the work in the main process.
The plan parallel plan that you've shown, given no extra worker
processes, would most likely perform the same as the serial plan you
showed, since the extra Finalize Aggregate node is only handling 1 row
anyway.

What's max_worker_processes set to?

If this is just a test machine, you should be able to see what's going
on if you install auto_explain, and enable auto_explain.log_analyze
(https://www.postgresql.org/docs/current/static/auto-explain.html)
Setting this up will log the EXPLAIN ANALYZE to the PostgreSQL logs
when you execute the query as normal.


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


pgsql-general by date:

Previous
From: Venkata B Nagothi
Date:
Subject: Re: Multi tenancy : schema vs databases
Next
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] pg_upgrade from 9.5 to 9.6 fails with "invalid argument"