Re: Slow query problem

Bruno Wolff III <bruno@wolff.to>

From: Bruno Wolff III <bruno@wolff.to>
To: Mike Glover <mpg4@duluoz.net>
Cc: Bradley Tate <btate@objectmastery.com>, pgsql-performance@postgresql.org
Date: 2004-01-09T04:23:38Z
Lists: pgsql-performance
On Thu, Jan 08, 2004 at 19:27:16 -0800,
  Mike Glover <mpg4@duluoz.net> wrote:
> 
> 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). 

Postgres also might be able to switch to a hash aggregate instead of
using a sort if sortmem is made large enough to hold the results for
all of the (estimated) groups.