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

Re: Odd out of memory problem.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Odd out of memory problem.
Date: 2012-03-26 15:18:26
Message-ID: 25811.1332775106@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> I'm really perplexed as to why this fairly simple query should cause an 
> out of memory error:
>     select loid, max(pageno) from ldata group by loid order by 2 desc
>     limit 10;

Looks like the group by/aggregate step is eating lots of memory:

>              AggContext: 864018432 total in 127 blocks; 3400 free (110
>     chunks); 864015032 used
>                TupleHashTable: 619175960 total in 95 blocks; 821528 free
>     (331 chunks); 618354432 used

A guess is that there are a huge number of distinct values of "loid" but
the planner fails to realize that and tries to use a hash aggregation.
Could we see EXPLAIN output for this query?

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2012-03-26 15:48:18
Subject: Re: Odd out of memory problem.
Previous:From: Hans-Jürgen SchönigDate: 2012-03-26 15:16:42
Subject: Re: Odd out of memory problem.

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