Re: Slow query problem

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mike Glover <mpg4@duluoz.net>
Cc: Bradley Tate <btate@objectmastery.com>, pgsql-performance@postgresql.org
Date: 2004-01-09T05:12:07Z
Lists: pgsql-performance
Mike Glover <mpg4@duluoz.net> writes:
> You should bump sort_mem as high as you can stand.  with only 8MB sort
> memory available, you're swapping intermediate sort pages to disk --
> a lot. Try the query with sort_mem set to 75MB (to do the entire sort in
> memory). 

7.4 will probably flip over to a hash-based aggregation method, and not
sort at all, once you make sort_mem large enough that it thinks the hash
table will fit in sort_mem.

			regards, tom lane