From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Sort performance cliff with small work_mem |
Date: | 2018-05-02 17:56:34 |
Message-ID: | CAH2-Wzk6n_puDM8K=NhALZ68+i3Ffej4GfpXNL0Aw7Y2gj28bA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, May 2, 2018 at 10:43 AM, Heikki Linnakangas <hlinnaka(at)iki(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-05-02 18:06:59 | Re: Sort performance cliff with small work_mem |
Previous Message | Peter Geoghegan | 2018-05-02 17:48:37 | Re: Sort performance cliff with small work_mem |