Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-08-09 10:17:51
Subject: Re: more personal copyrights
Previous:From: Pavel StehuleDate: 2010-08-09 09:26:13
Subject: Re: GROUPING SETS revisited

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group