Re: BUG #5608: array_agg() consumes too much memory

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #5608: array_agg() consumes too much memory
Date: 2010-08-14 02:36:11
Message-ID: AANLkTin2=0XFw8JDt5UbpkrL_kdfrLQzsnA0zZ+d2VZL@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

2010/8/10 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Eventually it might be nice to have some sort of way to specify the
> estimate to use for any aggregate function --- but for a near-term
> fix maybe we should just hard-wire a special case for array_agg in
> count_agg_clauses_walker().

The attached patch is the near-term fix; it adds ALLOCSET_DEFAULT_INITSIZE
bytes to memory assumption.

We might need the same adjustment for string_agg(), that consumes
1024 bytes for the transit condition. array_agg() and string_agg()
are only aggregates that have "internal" for aggtranstype.

--
Itagaki Takahiro

Attachment Content-Type Size
array_agg_memcalc.patch application/octet-stream 1.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hitoshi Harada 2010-08-14 04:50:58 Re: BUG #5608: array_agg() consumes too much memory
Previous Message Samuel Marinov 2010-08-14 00:14:37 BUG #5620: PostgreSQL won't accept the word "user" as a valid column name

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-08-14 02:53:57 Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys.
Previous Message Stephen Frost 2010-08-14 02:28:04 Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys.