Re: Sort performance cliff with small work_mem

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Sort performance cliff with small work_mem
Дата
Msg-id CAH2-Wzk6n_puDM8K=NhALZ68+i3Ffej4GfpXNL0Aw7Y2gj28bA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Sort performance cliff with small work_mem  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
On Wed, May 2, 2018 at 10:43 AM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> I'm not sure what you could derive that from, to make it less arbitrary. At
> the moment, I'm thinking of just doing something like this:
>
> /*
>  * Minimum amount of memory reserved to hold the sorted tuples in
>  * TSS_BUILDRUNS phase.  This specifies a minimum size for the merge runs,
>  * when work_mem is very small.
>  */
> #define MIN_TUPLE_MEMORY        (32 * 1024)

If you end up doing something like this, I suggest that you also
change this code to simply assign 1024 (or maybe a new preprocessor
constant):

state->memtupsize = Max(1024, ALLOCSET_SEPARATE_THRESHOLD /
sizeof(SortTuple) + 1);

The ALLOCSET_SEPARATE_THRESHOLD part can become a static assertion.

-- 
Peter Geoghegan


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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Sort performance cliff with small work_mem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Sort performance cliff with small work_mem