diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2020-05-09 19:41:42 +0200 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2020-05-09 19:41:42 +0200 |
commit | ebeb3dea772652887b67a7549906f5a9ec8a487f (patch) | |
tree | 833c56f3b3c9c966eb0370adc93310bddbcd9372 /src/backend/commands/explain.c | |
parent | 9155b4be9a13038d59a7a09a27b7fbce3819eb08 (diff) | |
download | postgresql-ebeb3dea772652887b67a7549906f5a9ec8a487f.tar.gz postgresql-ebeb3dea772652887b67a7549906f5a9ec8a487f.zip |
Simplify show_incremental_sort_info a bit
Incremental sort always processes at least one full group group before
switching to prefix groups, so it's enough to check just the number of
full groups. There was no risk of division by zero due to the extra
condition, but it made the code harder to understand.
Reported-by: Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAp+7qoS92-4V1vLChpdY3vEkLCbf+gye6P-4cirE-0z0A@mail.gmail.com
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 1275bec6732..5695802081d 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -2922,7 +2922,6 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate, * contribute anything meaningful. */ fullsortGroupInfo = &incsort_info->fullsortGroupInfo; - prefixsortGroupInfo = &incsort_info->prefixsortGroupInfo; /* * Since we never have any prefix groups unless we've first sorted @@ -2930,8 +2929,7 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate, * prefix group), we don't need to do anything if there were 0 full * groups. */ - if (fullsortGroupInfo->groupCount == 0 && - prefixsortGroupInfo->groupCount == 0) + if (fullsortGroupInfo->groupCount == 0) continue; if (es->workers_state) @@ -2940,6 +2938,7 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate, indent_first_line = es->workers_state == NULL || es->verbose; show_incremental_sort_group_info(fullsortGroupInfo, "Full-sort", indent_first_line, es); + prefixsortGroupInfo = &incsort_info->prefixsortGroupInfo; if (prefixsortGroupInfo->groupCount > 0) { if (es->format == EXPLAIN_FORMAT_TEXT) |