|
|
@ -109,7 +109,7 @@ begin |
|
|
|
for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop |
|
|
|
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 |
|
|
|
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, '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; |
|
|
|
end loop; |
|
|
|
end loop; |
|
|
|
nodes := nodes || node; |
|
|
|
nodes := nodes || node; |
|
|
@ -131,7 +131,7 @@ begin |
|
|
|
for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop |
|
|
|
for group_key in select unnest(array['Full-sort Groups', 'Presorted Groups']::text[]) t loop |
|
|
|
group_stats := node->group_key; |
|
|
|
group_stats := node->group_key; |
|
|
|
for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop |
|
|
|
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; |
|
|
|
raise exception '% has invalid max space < average space', group_key; |
|
|
|
end if; |
|
|
|
end if; |
|
|
|
end loop; |
|
|
|
end loop; |
|
|
@ -545,34 +545,34 @@ select explain_analyze_without_memory('select * from (select * from t order by a |
|
|
|
(9 rows) |
|
|
|
(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')); |
|
|
|
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 |
|
|
|
jsonb_pretty |
|
|
|
-------------------------------------------------- |
|
|
|
------------------------------------------------- |
|
|
|
[ + |
|
|
|
[ + |
|
|
|
{ + |
|
|
|
{ + |
|
|
|
"Sort Key": [ + |
|
|
|
"Sort Key": [ + |
|
|
|
"t.a", + |
|
|
|
"t.a", + |
|
|
|
"t.b" + |
|
|
|
"t.b" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Node Type": "Incremental Sort", + |
|
|
|
"Node Type": "Incremental Sort", + |
|
|
|
"Actual Rows": 55, + |
|
|
|
"Actual Rows": 55, + |
|
|
|
"Actual Loops": 1, + |
|
|
|
"Actual Loops": 1, + |
|
|
|
"Presorted Key": [ + |
|
|
|
"Presorted Key": [ + |
|
|
|
"t.a" + |
|
|
|
"t.a" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Parallel Aware": false, + |
|
|
|
"Parallel Aware": false, + |
|
|
|
"Full-sort Groups": { + |
|
|
|
"Full-sort Groups": { + |
|
|
|
"Group Count": 2, + |
|
|
|
"Group Count": 2, + |
|
|
|
"Sort Methods Used": [ + |
|
|
|
"Sort Methods Used": [ + |
|
|
|
"top-N heapsort", + |
|
|
|
"top-N heapsort", + |
|
|
|
"quicksort" + |
|
|
|
"quicksort" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Sort Space Memory": { + |
|
|
|
"Sort Space Memory": { + |
|
|
|
"Average Sort Space Used": "NN",+ |
|
|
|
"Peak Sort Space Used": "NN", + |
|
|
|
"Maximum Sort Space Used": "NN" + |
|
|
|
"Average Sort Space Used": "NN"+ |
|
|
|
} + |
|
|
|
} + |
|
|
|
}, + |
|
|
|
}, + |
|
|
|
"Parent Relationship": "Outer" + |
|
|
|
"Parent Relationship": "Outer" + |
|
|
|
} + |
|
|
|
} + |
|
|
|
] |
|
|
|
] |
|
|
|
(1 row) |
|
|
|
(1 row) |
|
|
|
|
|
|
|
|
|
|
@ -719,43 +719,43 @@ select explain_analyze_without_memory('select * from (select * from t order by a |
|
|
|
(9 rows) |
|
|
|
(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')); |
|
|
|
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 |
|
|
|
jsonb_pretty |
|
|
|
-------------------------------------------------- |
|
|
|
------------------------------------------------- |
|
|
|
[ + |
|
|
|
[ + |
|
|
|
{ + |
|
|
|
{ + |
|
|
|
"Sort Key": [ + |
|
|
|
"Sort Key": [ + |
|
|
|
"t.a", + |
|
|
|
"t.a", + |
|
|
|
"t.b" + |
|
|
|
"t.b" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Node Type": "Incremental Sort", + |
|
|
|
"Node Type": "Incremental Sort", + |
|
|
|
"Actual Rows": 70, + |
|
|
|
"Actual Rows": 70, + |
|
|
|
"Actual Loops": 1, + |
|
|
|
"Actual Loops": 1, + |
|
|
|
"Presorted Key": [ + |
|
|
|
"Presorted Key": [ + |
|
|
|
"t.a" + |
|
|
|
"t.a" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Parallel Aware": false, + |
|
|
|
"Parallel Aware": false, + |
|
|
|
"Full-sort Groups": { + |
|
|
|
"Full-sort Groups": { + |
|
|
|
"Group Count": 1, + |
|
|
|
"Group Count": 1, + |
|
|
|
"Sort Methods Used": [ + |
|
|
|
"Sort Methods Used": [ + |
|
|
|
"quicksort" + |
|
|
|
"quicksort" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Sort Space Memory": { + |
|
|
|
"Sort Space Memory": { + |
|
|
|
"Average Sort Space Used": "NN",+ |
|
|
|
"Peak Sort Space Used": "NN", + |
|
|
|
"Maximum Sort Space Used": "NN" + |
|
|
|
"Average Sort Space Used": "NN"+ |
|
|
|
} + |
|
|
|
} + |
|
|
|
}, + |
|
|
|
}, + |
|
|
|
"Presorted Groups": { + |
|
|
|
"Presorted Groups": { + |
|
|
|
"Group Count": 5, + |
|
|
|
"Group Count": 5, + |
|
|
|
"Sort Methods Used": [ + |
|
|
|
"Sort Methods Used": [ + |
|
|
|
"quicksort" + |
|
|
|
"quicksort" + |
|
|
|
], + |
|
|
|
], + |
|
|
|
"Sort Space Memory": { + |
|
|
|
"Sort Space Memory": { + |
|
|
|
"Average Sort Space Used": "NN",+ |
|
|
|
"Peak Sort Space Used": "NN", + |
|
|
|
"Maximum Sort Space Used": "NN" + |
|
|
|
"Average Sort Space Used": "NN"+ |
|
|
|
} + |
|
|
|
} + |
|
|
|
}, + |
|
|
|
}, + |
|
|
|
"Parent Relationship": "Outer" + |
|
|
|
"Parent Relationship": "Outer" + |
|
|
|
} + |
|
|
|
} + |
|
|
|
] |
|
|
|
] |
|
|
|
(1 row) |
|
|
|
(1 row) |
|
|
|
|
|
|
|
|
|
|
|