Re: PATCH: decreasing memory needlessly consumed by array_agg

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: PATCH: decreasing memory needlessly consumed by array_agg
Дата
Msg-id 1421738534.12308.5.camel@jeff-desktop
обсуждение исходный текст
Ответ на Re: PATCH: decreasing memory needlessly consumed by array_agg  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: PATCH: decreasing memory needlessly consumed by array_agg  (Ali Akbar <the.apaan@gmail.com>)
Re: PATCH: decreasing memory needlessly consumed by array_agg  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sun, Dec 28, 2014 at 11:53 PM, Jeff Davis <pgsql@j-davis.com> wrote:
> On Tue, 2014-04-01 at 13:08 -0400, Tom Lane wrote:
>> I think a patch that stood a chance of getting committed would need to
>> detect whether the aggregate was being called in simple or grouped
>> contexts, and apply different behaviors in the two cases.
>
> The simple context doesn't seem like a big problem even if we change
> things as Tomas suggests:
>
> "IMNSHO these are the issues we really should fix - by lowering the
> initial element count (64->4) and using a single memory context."
>
> In the simple context, there's only one context regardless, so the only
> cost I see is from reducing the initial allocation from 64 to some lower
> number. But if we're doubling each time, it won't take long to get
> there; and because it's the simple context, we only need to do it once.

Tom (tgl),

Is my reasoning above acceptable?

The current patch, which I am evaluating for commit, does away with
per-group memory contexts (it uses a common context for all groups), and
reduces the initial array allocation from 64 to 8 (but preserves
doubling behavior).

Regards,Jeff Davis







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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Error check always bypassed in tablefunc.c
Следующее
От: Andres Freund
Дата:
Сообщение: Re: New CF app deployment