auto_explain and parallel queries issue

Started by Pavel Stehuleover 7 years ago3 messages
#1Pavel Stehule
pavel.stehule@gmail.com

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

#2Tomas Vondra
tomas.vondra@2ndquadrant.com
In reply to: Pavel Stehule (#1)
Re: auto_explain and parallel queries issue

On 04/16/2018 09:25 AM, Pavel Stehule wrote:

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.

FWIW this is the same issue that I reported in 2016:

/messages/by-id/3f62f24e-51b3-175c-9222-95f25fd2a9d6@2ndquadrant.com

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tomas Vondra (#2)
Re: auto_explain and parallel queries issue

2018-04-16 10:33 GMT+02:00 Tomas Vondra <tomas.vondra@2ndquadrant.com>:

On 04/16/2018 09:25 AM, Pavel Stehule wrote:

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.

FWIW this is the same issue that I reported in 2016:

/messages/by-id/3f62f24e-51b3-175c-
9222-95f25fd2a9d6%402ndquadrant.com

yes. The fix should not be too hard. The report can do only process who
owns query text

Regards

Pavel

Show quoted text

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services