Re: Summary Sort workers Stats in EXPLAIN ANALYZE
От | Jian Guo |
---|---|
Тема | Re: Summary Sort workers Stats in EXPLAIN ANALYZE |
Дата | |
Msg-id | SN6PR05MB519978F0435079207762C54EC4199@SN6PR05MB5199.namprd05.prod.outlook.com обсуждение исходный текст |
Ответ на | Re: Summary Sort workers Stats in EXPLAIN ANALYZE (Jian Guo <gjian@vmware.com>) |
Ответы |
Re: Summary Sort workers Stats in EXPLAIN ANALYZE
(Julien Rouhaud <rjuju123@gmail.com>)
|
Список | pgsql-hackers |
For a simple demo, with this explain statement:
-- Test sort stats summaryset force_parallel_mode=on;select explain_filter('explain (analyze, summary off, timing off, costs off, format json) select * from tenk1 order by unique1');
Before this patch, we got plan like this:
"Node Type": "Sort", +"Parent Relationship": "Outer", +"Parallel Aware": false, +"Async Capable": false, +"Actual Rows": 10000, +"Actual Loops": 1, +"Sort Key": ["unique1"], +"Workers": [ +{ +"Worker Number": 0, +"Sort Method": "external merge",+"Sort Space Used": 2496, +"Sort Space Type": "Disk" +} +], +
After this patch, the effected plan is this:
"Node Type": "Sort", +"Parent Relationship": "Outer", +"Parallel Aware": false, +"Async Capable": false, +"Actual Rows": N, +"Actual Loops": N, +"Sort Key": ["unique1"], +"Workers planned": N, +"Sort Method": "external merge", +"Average Sort Space Used": N, +"Peak Sort Space Used": N, +"Sort Space Type": "Disk", +
From: Jian Guo <gjian@vmware.com>
Sent: Monday, March 21, 2022 15:50
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Zhenghua Lyu <zlyu@vmware.com>
Subject: Re: Summary Sort workers Stats in EXPLAIN ANALYZE
Sent: Monday, March 21, 2022 15:50
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Zhenghua Lyu <zlyu@vmware.com>
Subject: Re: Summary Sort workers Stats in EXPLAIN ANALYZE
There is some problem with the last patch, I have removed the `ExplainOpenWorker` call to fix.
And also, I have added a test case in
explain.sql
according to the code change.From: Jian Guo <gjian@vmware.com>
Sent: Monday, March 21, 2022 11:36
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Zhenghua Lyu <zlyu@vmware.com>
Subject: Summary Sort workers Stats in EXPLAIN ANALYZE
Sent: Monday, March 21, 2022 11:36
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Zhenghua Lyu <zlyu@vmware.com>
Subject: Summary Sort workers Stats in EXPLAIN ANALYZE
In current EXPLAIN ANALYZE implementation, the Sort Node stats from each workers are not summarized: https://github.com/postgres/postgres/blob/d4ba8b51c76300f06cc23f4d8a41d9f7210c4866/src/backend/commands/explain.c#L2762
When the worker number is large, it will print out huge amount of node details in the plan. I have created this patch to summarize the tuplesort stats by AverageSpaceUsed / PeakSpaceUsed, make it behave just like in `show_incremental_sort_group_info()`: https://github.com/postgres/postgres/blob/d4ba8b51c76300f06cc23f4d8a41d9f7210c4866/src/backend/commands/explain.c#L2890
В списке pgsql-hackers по дате отправления:
Следующее
От: Michael PaquierДата:
Сообщение: Re: Allow file inclusion in pg_hba and pg_ident files