BUG #5608: array_agg() consumes too much memory

From: "Itagaki Takahiro" <itagaki(dot)takahiro(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5608: array_agg() consumes too much memory
Date: 2010-08-09 09:41:12
Message-ID: 201008090941.o799fCCF057912@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


The following bug has been logged online:

Bug reference: 5608
Logged by: Itagaki Takahiro
Email address: itagaki(dot)takahiro(at)gmail(dot)com
PostgreSQL version: 9.0beta4
Operating system: Windows 7 (32bit)
Description: array_agg() consumes too much memory
Details:

I encountered "out of memory" error in large
GROUP BY query with array_agg(). The server log
was filled by the following messages:

accumArrayResult: 8192 total in 1 blocks; 7800 free (0 chunks); 392
used

Should we choose smaller size of initial memory in accumArrayResult()?
It allocates ALLOCSET_DEFAULT_INITSIZE (=8kB) now,
but only 10% of the area was used in my case.

Note that work_mem is not considered in the case;
array_agg() allocates 8kB * (number of groups).

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2010-08-09 11:42:45 Assertion failure with assignment to array elem
Previous Message Patric de Waha 2010-08-09 07:59:35 Automated analyze process fails with custom function, which works perfect as regular user (8.4.2).

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-09 10:17:51 Re: more personal copyrights
Previous Message Pavel Stehule 2010-08-09 09:26:13 Re: GROUPING SETS revisited