aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2020-04-07 18:03:24 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2020-04-07 18:25:13 +0200
commitd22782a5392f6a1cb6cfca34031b93eb9dd2aa03 (patch)
treed49831da8514cd1aa83b076232c3d4c499d52ff8 /src/backend/commands/explain.c
parent4bd0ad9e44be9fbc3ad77747d7672dab1c3df7d9 (diff)
downloadpostgresql-d22782a5392f6a1cb6cfca34031b93eb9dd2aa03.tar.gz
postgresql-d22782a5392f6a1cb6cfca34031b93eb9dd2aa03.zip
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/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index baaa5817af7..455f54ef83f 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2841,7 +2841,7 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
ExplainOpenGroup("Sort Space", memoryName.data, true, es);
ExplainPropertyInteger("Average Sort Space Used", "kB", avgSpace, es);
- ExplainPropertyInteger("Maximum Sort Space Used", "kB",
+ ExplainPropertyInteger("Peak Sort Space Used", "kB",
groupInfo->maxMemorySpaceUsed, es);
ExplainCloseGroup("Sort Spaces", memoryName.data, true, es);
@@ -2858,7 +2858,7 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
ExplainOpenGroup("Sort Space", diskName.data, true, es);
ExplainPropertyInteger("Average Sort Space Used", "kB", avgSpace, es);
- ExplainPropertyInteger("Maximum Sort Space Used", "kB",
+ ExplainPropertyInteger("Peak Sort Space Used", "kB",
groupInfo->maxDiskSpaceUsed, es);
ExplainCloseGroup("Sort Spaces", diskName.data, true, es);
@@ -2883,6 +2883,15 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
if (!es->analyze)
return;
+ /*
+ * Since we never have any prefix groups unless we've first sorted a full
+ * groups and transitioned modes (copying the tuples into a prefix group),
+ * we don't need to do anything if there were 0 full groups.
+ *
+ * We still have to continue after this block if there are no full groups,
+ * though, since it's possible that we have workers that did real work even
+ * if the leader didn't participate.
+ */
if (fullsortGroupInfo->groupCount > 0)
{
show_incremental_sort_group_info(fullsortGroupInfo, "Full-sort", true, es);
@@ -2914,6 +2923,13 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
*/
fullsortGroupInfo = &incsort_info->fullsortGroupInfo;
prefixsortGroupInfo = &incsort_info->prefixsortGroupInfo;
+
+ /*
+ * Since we never have any prefix groups unless we've first sorted
+ * a full groups and transitioned modes (copying the tuples into a
+ * prefix group), we don't need to do anything if there were 0 full
+ * groups.
+ */
if (fullsortGroupInfo->groupCount == 0 &&
prefixsortGroupInfo->groupCount == 0)
continue;