Re: array_agg() on a set larger than some arbitrary(?) limit causes runaway memory usage and eventually memory exhaustion

From: "Tomas Vondra" <tv(at)fuzzy(dot)cz>
To: "Frank van Vugt" <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org, "Tomas Vondra" <tv(at)fuzzy(dot)cz>
Subject: Re: array_agg() on a set larger than some arbitrary(?) limit causes runaway memory usage and eventually memory exhaustion
Date: 2013-10-20 10:57:43
Message-ID: c1b68cb9c6007d7fd7bcdbce3e8a9983.squirrel@sq.gransy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 20 Říjen 2013, 10:26, Frank van Vugt wrote:
>
> I never ran into this earlier (and I've been using PostgreSQL for quite
> some
> time now) and even now, this is not about a 'production query', so I'm
> happy
> with any and all benefits for future versions that come from this ;)
>
> Having said that, should you want me to check the effects of some patch,
> just
> let me know, I'd be happy to do that.

Attached is a quick patch removing the local memory context and using
aggcontext instead. I've also tuned down the preallocation. It's against
9.2 stable, so it should apply fine against your 9.2.4. But be careful,
it's not really tested.

Tomas

Attachment Content-Type Size
array_agg.patch text/x-diff 1.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Valentine Gogichashvili 2013-10-20 12:06:19 Re: array_agg() on a set larger than some arbitrary(?) limit causes runaway memory usage and eventually memory exhaustion
Previous Message Frank van Vugt 2013-10-20 08:26:53 Re: array_agg() on a set larger than some arbitrary(?) limit causes runaway memory usage and eventually memory exhaustion