Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ebeb3de

Browse files
committed
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
1 parent 9155b4b commit ebeb3de

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/backend/commands/explain.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,16 +2922,14 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
29222922
* contribute anything meaningful.
29232923
*/
29242924
fullsortGroupInfo = &incsort_info->fullsortGroupInfo;
2925-
prefixsortGroupInfo = &incsort_info->prefixsortGroupInfo;
29262925

29272926
/*
29282927
* Since we never have any prefix groups unless we've first sorted
29292928
* a full groups and transitioned modes (copying the tuples into a
29302929
* prefix group), we don't need to do anything if there were 0 full
29312930
* groups.
29322931
*/
2933-
if (fullsortGroupInfo->groupCount == 0 &&
2934-
prefixsortGroupInfo->groupCount == 0)
2932+
if (fullsortGroupInfo->groupCount == 0)
29352933
continue;
29362934

29372935
if (es->workers_state)
@@ -2940,6 +2938,7 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
29402938
indent_first_line = es->workers_state == NULL || es->verbose;
29412939
show_incremental_sort_group_info(fullsortGroupInfo, "Full-sort",
29422940
indent_first_line, es);
2941+
prefixsortGroupInfo = &incsort_info->prefixsortGroupInfo;
29432942
if (prefixsortGroupInfo->groupCount > 0)
29442943
{
29452944
if (es->format == EXPLAIN_FORMAT_TEXT)

0 commit comments

Comments
 (0)