Re: PATCH: decreasing memory needlessly consumed by array_agg - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: PATCH: decreasing memory needlessly consumed by array_agg
Date
Msg-id 533B14DA.9030907@fuzzy.cz
Whole thread Raw
In response to Re: PATCH: decreasing memory needlessly consumed by array_agg  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 1.4.2014 20:56, Tom Lane wrote:
> Tomas Vondra <tv@fuzzy.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PATCH: decreasing memory needlessly consumed by array_agg
Next
From: Jim Nasby
Date:
Subject: Re: json/jsonb/hstore operator precedence