Re: PATCH: decreasing memory needlessly consumed by array_agg

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: decreasing memory needlessly consumed by array_agg
Date: 2014-04-01 19:34:50
Message-ID: 533B14DA.9030907@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1.4.2014 20:56, Tom Lane wrote:
> Tomas Vondra <tv(at)fuzzy(dot)cz> writes:
>> On 1.4.2014 19:08, Tom Lane wrote:
> You're conveniently ignoring the callers that set release=true.
> Reverse engineering a query that exhibits memory bloat is left
> as an exercise for the reader (but in a quick look, I'll bet
> ARRAY_SUBLINK subplans are one locus for problems).

No, I'm not. I explicitly mentioned those cases (although you're right I
concentrated mostly on cases with release=false, because of array_agg).

> It's possible that it'd work to use a subcontext only if
> release=true; I've not dug through the code enough to convince myself
> of that.

Maybe, though 'release' is not available in makeArrayResult() which is
where the memory context needs to be decided. So all the callers would
need to be modified to supply this parameter. But there only ~15 places
where makeArrayResult is called.

regards
Tomas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-04-01 19:40:29 Re: json/jsonb/hstore operator precedence
Previous Message Tom Lane 2014-04-01 18:56:05 Re: PATCH: decreasing memory needlessly consumed by array_agg