Re: PATCH: decreasing memory needlessly consumed by array_agg

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: decreasing memory needlessly consumed by array_agg
Date: 2014-12-29 07:53:21
Message-ID: 1419839601.24895.100.camel@jeff-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-12-29 10:06:07 Re: [COMMITTERS] pgsql: Keep track of transaction commit timestamps
Previous Message Borodin Vladimir 2014-12-29 07:46:30 Re: ExclusiveLock on extension of relation with huge shared_buffers