diff options
| author | Tomas Vondra | 2020-04-07 16:03:24 +0000 |
|---|---|---|
| committer | Tomas Vondra | 2020-04-07 16:25:13 +0000 |
| commit | d22782a5392f6a1cb6cfca34031b93eb9dd2aa03 (patch) | |
| tree | d49831da8514cd1aa83b076232c3d4c499d52ff8 /src/test | |
| parent | 4bd0ad9e44be9fbc3ad77747d7672dab1c3df7d9 (diff) | |
Minor improvements in Incremental Sort explain
Some places still used "Maximum" instead of "Peak" when displaying info
about sort space, so fix that. Also, add a comment clarifying why it's
correct to check the number of full/prefix sort groups.
Author: James Coleman
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/incremental_sort.out | 134 | ||||
| -rw-r--r-- | src/test/regress/sql/incremental_sort.sql | 4 |
2 files changed, 69 insertions, 69 deletions
diff --git a/src/test/regress/expected/incremental_sort.out b/src/test/regress/expected/incremental_sort.out index d32b774c551..3072d956437 100644 --- a/src/test/regress/expected/incremental_sort.out +++ b/src/test/regress/expected/incremental_sort.out @@ -109,7 +109,7 @@ begin for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop node := jsonb_set(node, array[group_key, space_key, 'Average Sort Space Used'], '"NN"', false); - node := jsonb_set(node, array[group_key, space_key, 'Maximum Sort Space Used'], '"NN"', false); + node := jsonb_set(node, array[group_key, space_key, 'Peak Sort Space Used'], '"NN"', false); end loop; end loop; nodes := nodes || node; @@ -131,7 +131,7 @@ begin for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop group_stats := node->group_key; for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop - if (group_stats->space_key->'Maximum Sort Space Used')::bigint < (group_stats->space_key->'Maximum Sort Space Used')::bigint then + if (group_stats->space_key->'Peak Sort Space Used')::bigint < (group_stats->space_key->'Peak Sort Space Used')::bigint then raise exception '% has invalid max space < average space', group_key; end if; end loop; @@ -545,34 +545,34 @@ select explain_analyze_without_memory('select * from (select * from t order by a (9 rows) select jsonb_pretty(explain_analyze_inc_sort_nodes_without_memory('select * from (select * from t order by a) s order by a, b limit 55')); - jsonb_pretty --------------------------------------------------- - [ + - { + - "Sort Key": [ + - "t.a", + - "t.b" + - ], + - "Node Type": "Incremental Sort", + - "Actual Rows": 55, + - "Actual Loops": 1, + - "Presorted Key": [ + - "t.a" + - ], + - "Parallel Aware": false, + - "Full-sort Groups": { + - "Group Count": 2, + - "Sort Methods Used": [ + - "top-N heapsort", + - "quicksort" + - ], + - "Sort Space Memory": { + - "Average Sort Space Used": "NN",+ - "Maximum Sort Space Used": "NN" + - } + - }, + - "Parent Relationship": "Outer" + - } + + jsonb_pretty +------------------------------------------------- + [ + + { + + "Sort Key": [ + + "t.a", + + "t.b" + + ], + + "Node Type": "Incremental Sort", + + "Actual Rows": 55, + + "Actual Loops": 1, + + "Presorted Key": [ + + "t.a" + + ], + + "Parallel Aware": false, + + "Full-sort Groups": { + + "Group Count": 2, + + "Sort Methods Used": [ + + "top-N heapsort", + + "quicksort" + + ], + + "Sort Space Memory": { + + "Peak Sort Space Used": "NN", + + "Average Sort Space Used": "NN"+ + } + + }, + + "Parent Relationship": "Outer" + + } + ] (1 row) @@ -719,43 +719,43 @@ select explain_analyze_without_memory('select * from (select * from t order by a (9 rows) select jsonb_pretty(explain_analyze_inc_sort_nodes_without_memory('select * from (select * from t order by a) s order by a, b limit 70')); - jsonb_pretty --------------------------------------------------- - [ + - { + - "Sort Key": [ + - "t.a", + - "t.b" + - ], + - "Node Type": "Incremental Sort", + - "Actual Rows": 70, + - "Actual Loops": 1, + - "Presorted Key": [ + - "t.a" + - ], + - "Parallel Aware": false, + - "Full-sort Groups": { + - "Group Count": 1, + - "Sort Methods Used": [ + - "quicksort" + - ], + - "Sort Space Memory": { + - "Average Sort Space Used": "NN",+ - "Maximum Sort Space Used": "NN" + - } + - }, + - "Presorted Groups": { + - "Group Count": 5, + - "Sort Methods Used": [ + - "quicksort" + - ], + - "Sort Space Memory": { + - "Average Sort Space Used": "NN",+ - "Maximum Sort Space Used": "NN" + - } + - }, + - "Parent Relationship": "Outer" + - } + + jsonb_pretty +------------------------------------------------- + [ + + { + + "Sort Key": [ + + "t.a", + + "t.b" + + ], + + "Node Type": "Incremental Sort", + + "Actual Rows": 70, + + "Actual Loops": 1, + + "Presorted Key": [ + + "t.a" + + ], + + "Parallel Aware": false, + + "Full-sort Groups": { + + "Group Count": 1, + + "Sort Methods Used": [ + + "quicksort" + + ], + + "Sort Space Memory": { + + "Peak Sort Space Used": "NN", + + "Average Sort Space Used": "NN"+ + } + + }, + + "Presorted Groups": { + + "Group Count": 5, + + "Sort Methods Used": [ + + "quicksort" + + ], + + "Sort Space Memory": { + + "Peak Sort Space Used": "NN", + + "Average Sort Space Used": "NN"+ + } + + }, + + "Parent Relationship": "Outer" + + } + ] (1 row) diff --git a/src/test/regress/sql/incremental_sort.sql b/src/test/regress/sql/incremental_sort.sql index 2ba5d7a67d1..e78a96d5bf0 100644 --- a/src/test/regress/sql/incremental_sort.sql +++ b/src/test/regress/sql/incremental_sort.sql @@ -85,7 +85,7 @@ begin for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop node := jsonb_set(node, array[group_key, space_key, 'Average Sort Space Used'], '"NN"', false); - node := jsonb_set(node, array[group_key, space_key, 'Maximum Sort Space Used'], '"NN"', false); + node := jsonb_set(node, array[group_key, space_key, 'Peak Sort Space Used'], '"NN"', false); end loop; end loop; nodes := nodes || node; @@ -108,7 +108,7 @@ begin for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop group_stats := node->group_key; for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop - if (group_stats->space_key->'Maximum Sort Space Used')::bigint < (group_stats->space_key->'Maximum Sort Space Used')::bigint then + if (group_stats->space_key->'Peak Sort Space Used')::bigint < (group_stats->space_key->'Peak Sort Space Used')::bigint then raise exception '% has invalid max space < average space', group_key; end if; end loop; |
