auto_explain and parallel queries issue - Mailing list pgsql-hackers

From Pavel Stehule
Subject auto_explain and parallel queries issue
Date
Msg-id CAFj8pRD_C=RdVW4wUBEMFJFUEM7YOpdJ0kBKFzb0Xn4dnaJyUA@mail.gmail.com
Whole thread Raw
Responses Re: auto_explain and parallel queries issue
List 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


pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: submake-errcodes
Next
From: Amit Langote
Date:
Subject: Re: partitioning code reorganization