Re: Odd out of memory problem. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Odd out of memory problem.
Date
Msg-id 25811.1332775106@sss.pgh.pa.us
Whole thread Raw
In response to Odd out of memory problem.  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Odd out of memory problem.  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.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


pgsql-hackers by date:

Previous
From: Hans-Jürgen Schönig
Date:
Subject: Re: Odd out of memory problem.
Next
From: Andrew Dunstan
Date:
Subject: Re: Odd out of memory problem.