auto_explain and parallel queries issue

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: auto_explain and parallel queries issue
Date: 2018-04-16 07:25:16
Message-ID: CAFj8pRD_C=RdVW4wUBEMFJFUEM7YOpdJ0kBKFzb0Xn4dnaJyUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I am testing PostgreSQL in customer's environment and I found some
unexpected behave.

When auto_explain is used, and there is slower parallel query, then
auto_explain raises log for any slow process.

arallel worker for PID 20089 : auto_explain database=NULL client=local
appname=psql
arallel worker for PID 20089 : duration: 121.250 ms plan:
arallel worker for PID 20089 : Query Text: select sum(a) from
bigtable group by b;
arallel worker for PID 20089 : Partial HashAggregate
(cost=10675.00..10774.59 rows=9959 width=12)
arallel worker for PID 20089 : Group Key: b
arallel worker for PID 20089 : -> Parallel Seq Scan on
bigtable (cost=0.00..8591.67 rows=416667 width=8)
arallel worker for PID 20089 : auto_explain database=NULL client=local
appname=psql
arallel worker for PID 20089 : duration: 128.247 ms plan:
arallel worker for PID 20089 : Query Text: select sum(a) from
bigtable group by b;
arallel worker for PID 20089 : Partial HashAggregate
(cost=10675.00..10774.59 rows=9959 width=12)
arallel worker for PID 20089 : Group Key: b
arallel worker for PID 20089 : -> Parallel Seq Scan on
bigtable (cost=0.00..8591.67 rows=416667 width=8)
res [local] SELECT: auto_explain database=postgres client=[local]
appname=psql
res [local] SELECT: duration: 149.478 ms plan:
res [local] SELECT: Query Text: select sum(a) from bigtable group
by b;
res [local] SELECT: Finalize HashAggregate
(cost=13865.98..13965.57 rows=9959 width=12)
res [local] SELECT: Group Key: b
res [local] SELECT: -> Gather (cost=11675.00..13766.39
rows=19918 width=12)
res [local] SELECT: Workers Planned: 2
res [local] SELECT: -> Partial HashAggregate
(cost=10675.00..10774.59 rows=9959 width=12)
res [local] SELECT: Group Key: b
res [local] SELECT: -> Parallel Seq Scan on
bigtable (cost=0.00..8591.67 rows=416667 width=8)

It is expected behave? Minimally it is undocumented and in this case a
global variable MyProcPort is not initialized.

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-04-16 07:46:34 Re: partitioning code reorganization
Previous Message Christoph Berg 2018-04-16 07:24:27 Re: submake-errcodes