Re: 9.5: Memory-bounded HashAgg

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: 9.5: Memory-bounded HashAgg
Дата
Msg-id 53EBA933.9070704@fuzzy.cz
обсуждение исходный текст
Ответ на Re: 9.5: Memory-bounded HashAgg  ("Tomas Vondra" <tv@fuzzy.cz>)
Список pgsql-hackers
On 13.8.2014 12:31, Tomas Vondra wrote:
> On 13 Srpen 2014, 7:02, Jeff Davis wrote:
>> On Tue, 2014-08-12 at 14:58 +0200, Tomas Vondra wrote:
>>>
>>>    (b) bad estimate of required memory -> this is common for aggregates
>>>        passing 'internal' state (planner uses some quite high defaults)
>>
>> Maybe some planner hooks? Ideas?
> 
> My plan is to add this to the CREATE AGGREGATE somehow - either as a
> constant parameter (allowing to set a custom constant size) or a callback
> to a 'sizing' function (estimating the size based on number of items,
> average width and ndistinct in the group). In any case, this is
> independent of this patch.

FWIW, the constant parameter is already implemented for 9.4. Adding the
function seems possible - the most difficult part seems to be getting
all the necessary info before count_agg_clauses() is called. For example
now dNumGroups is evaluated after the call (and tuples/group seems like
a useful info for sizing).

While this seems unrelated to the patch discussed here, it's true that:
 (a) good estimate of the memory is important for initial estimate of     batch count
 (b) dynamic increase of batch count alleviates issues from     underestimating the amount of memory necessary for
states


But let's leave this out of scope for the current patch.


regards
Tomas



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

Предыдущее
От: Claudio Freire
Дата:
Сообщение: Re: jsonb format is pessimal for toast compression
Следующее
От: Euler Taveira
Дата:
Сообщение: Re: how to implement selectivity injection in postgresql