Re: PATCH: decreasing memory needlessly consumed by array_agg

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Ali Akbar <the(dot)apaan(at)gmail(dot)com>, Tomas Vondra <tv(at)fuzzy(dot)cz>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: decreasing memory needlessly consumed by array_agg
Date: 2014-12-22 02:44:32
Message-ID: 54978590.5000709@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/21/14, 7:08 PM, Ali Akbar wrote:
> Another positive benefit is that this won't break the code unless it
> uses the new API. This is a problem especially with external code (e.g.
> extensions), but the new API (initArray*) is not part of 9.4 so there's
> no such code. So that's nice.
>
> The one annoying thing is that this makes the API slighly unbalanced.
> With the new API you can use a shared memory context, which with the old
> one (not using the initArray* methods) you can't.
>
> But I'm OK with that, and it makes the patch smaller (15kB -> 11kB).
>
>
> Yes, with this API, we can backpatch this patch to 9.4 (or below) if we need it there.
>
> I think this API is a good compromise of old API and new API. Ideally if we can migrate all code to new API (all code must call initArrayResult* before accumArrayResult*), we can remove parameter MemoryContext rcontext from accumArrayResult. Currently, the code isn't using the rcontext for anything except for old API calls (in first call to accumArrayResult).

Until we eliminate the API though, we should leave something in place that still uses the old one, to make certain we don't accidentally break it.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2014-12-22 02:55:14 Re: Proposal "VACUUM SCHEMA"
Previous Message Michael Paquier 2014-12-22 02:34:29 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}