On Wed, May 2, 2018 at 10:43 AM, Heikki Linnakangas <hlinn...@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

Reply via email to