pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jgardner@comprehend.com
Subject: BUG #15232: Query execution changes based on using 'explain analyze' or not
Date: Thu, 07 Jun 2018 15:25:05 +0000
Message-ID: <152838510590.26728.14913938912964455418@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15232
Logged by:          durandal mk2
Email address:      jgardner@comprehend.com
PostgreSQL version: 10.4
Operating system:   ubuntu 18.04
Description:        

Testing behavior of parallel scans in 10.4 (looking to upgrade from 9.4) and
I'm only seeing parallel execution if I use "explain analyze".

Table setup is document_id int, version_id string 46million records

select
        document_id, 
        max(version_id) version_id 
from
        document_metadata
group by 1 

18 seconds, only a single process running

explain analyze
select
        document_id, 
        max(version_id) version_id 
from
        document_metadata
group by 1

same query but with explain analyze in front, I see multiple bgworker
processes spawn, 4 cores full loaded and query returns in 9 seconds

Finalize HashAggregate  (cost=927376.47..927830.76 rows=45429 width=38)
(actual time=8724.608..9001.714 rows=702294 loops=1)
  Group Key: document_id
  ->  Gather  (cost=907842.00..926467.89 rows=181716 width=38) (actual
time=7162.089..7962.289 rows=1460816 loops=1)
        Workers Planned: 4
        Workers Launched: 3
        ->  Partial HashAggregate  (cost=906842.00..907296.29 rows=45429
width=38) (actual time=7157.322..7303.906 rows=365204 loops=4)
              Group Key: document_id
              ->  Parallel Seq Scan on document_metadata 
(cost=0.00..849274.00 rows=11513600 width=16) (actual time=0.043..3380.886
rows=11513600 loops=4)
Planning time: 0.122 ms
Execution time: 9032.855 ms

Scanning the lists and googling didn't really turn up anything, if this is
unexpected I'll try regressing this against 10.3.

No combination of the following parameters seems to impact the query planner
when not using explain analyze.  Thanks in advance.

set max_parallel_degree = 4;
set min_parallel_relation_size = 0;
set parallel_setup_cost to 0;
set parallel_tuple_cost to 0;
set force_parallel_mode to on;



view thread (5+ messages)  latest in thread

Message-ID: <152838510590.26728.14913938912964455418@wrigleys.postgresql.org>
Permalink:  ../152838510590.26728.14913938912964455418@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/152838510590.26728.14913938912964455418@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, jgardner@comprehend.com
  Subject: Re: BUG #15232: Query execution changes based on using 'explain analyze' or not
  In-Reply-To: <152838510590.26728.14913938912964455418@wrigleys.postgresql.org>
  References: <152838510590.26728.14913938912964455418@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox