Re: HashAgg's batching counter starts at 0, but Hash's starts at 1. (now: incremental sort)

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: HashAgg's batching counter starts at 0, but Hash's starts at 1. (now: incremental sort)
Дата
Msg-id 20200731002245.GU20393@telsasoft.com
обсуждение исходный текст
Ответ на Re: HashAgg's batching counter starts at 0, but Hash's starts at 1.  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: HashAgg's batching counter starts at 0, but Hash's starts at 1. (now: incremental sort)  (Peter Geoghegan <pg@bowt.ie>)
Re: HashAgg's batching counter starts at 0, but Hash's starts at 1. (now: incremental sort)  (James Coleman <jtc331@gmail.com>)
Список pgsql-hackers
On Wed, Jul 29, 2020 at 09:18:44PM -0700, Peter Geoghegan wrote:
> On Wed, Jul 29, 2020 at 9:05 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> > So my 2ndary suggestion is to conditionalize based on the method rather than
> > value of space used.
> 
> What's the advantage of doing it that way?

Because filtering out zero values is exactly what's intended to be avoided for
nontext output.

I think checking whether the method was used should result in the same output,
without the literal check for zero value (which itself sets a bad example).

--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2824,13 +2824,13 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
                appendStringInfo(&groupName, "%s Groups", groupLabel);
                ExplainOpenGroup("Incremental Sort Groups", groupName.data, true, es);
                ExplainPropertyInteger("Group Count", NULL, groupInfo->groupCount, es);
 
                ExplainPropertyList("Sort Methods Used", methodNames, es);
 
-               if (groupInfo->maxMemorySpaceUsed > 0)
+               if (groupInfo->sortMethods & SORT_TYPE_QUICKSORT)
                {
                        long            avgSpace = groupInfo->totalMemorySpaceUsed / groupInfo->groupCount;
                        const char *spaceTypeName;
                        StringInfoData memoryName;
 
                        spaceTypeName = tuplesort_space_type_name(SORT_SPACE_TYPE_MEMORY);
@@ -2841,13 +2841,13 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
                        ExplainPropertyInteger("Average Sort Space Used", "kB", avgSpace, es);
                        ExplainPropertyInteger("Peak Sort Space Used", "kB",
                                                                   groupInfo->maxMemorySpaceUsed, es);
 
                        ExplainCloseGroup("Sort Spaces", memoryName.data, true, es);
                }
-               if (groupInfo->maxDiskSpaceUsed > 0)
+               if (groupInfo->sortMethods & SORT_TYPE_EXTERNAL_SORT)
                {
                        long            avgSpace = groupInfo->totalDiskSpaceUsed / groupInfo->groupCount;
                        const char *spaceTypeName;
                        StringInfoData diskName;
 
                        spaceTypeName = tuplesort_space_type_name(SORT_SPACE_TYPE_DISK);



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Missing CFI in hlCover()?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: proposal: type info support functions for functions that use "any" type