Edoardo Innocenti <edoardo.innocenti@xxxxxxxxxxxxxxxxx> writes: > Query Plan:<br> > "HashAggregate (cost=4910.06..4910.19 rows=1 width=659)" Hm ... the planner seems to think that this is a small query that isn't going to take long, which is a bit at odds with the fact that you're running out of memory. I suspect that these rowcount estimates are far too low, which would suggest that you need to make sure your ANALYZE statistics are up-to-date, and perhaps raise the statistics targets. Try to get the plan's estimated rowcounts to approximate reality. BTW, you might want to think about turning off your mail program's HTML option. What other people are seeing looks like this: http://archives.postgresql.org/pgsql-admin/2010-08/msg00126.php and it's not pretty. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin