Re: Slow query problem
Mike Glover <mpg4@duluoz.net>
From: Mike Glover <mpg4@duluoz.net>
To: Bradley Tate <btate@objectmastery.com>
Cc: pgsql-performance@postgresql.org
Date: 2004-01-09T03:27:16Z
Lists: pgsql-performance
On Thu, 08 Jan 2004 16:52:05 +1100 Bradley Tate <btate@objectmastery.com> wrote: > Am I correct in interpreting that most time was spent doing the > sorting? looks so. your table is about 70MB total size, and its getting loaded completely into memory (you have 12000 * 8k = 96M available). 26s to load 70MB from disk seems reasonable. The rest of the time is used for sorting. > Explain confuses the heck out of me and any help on how I could make > this run faster would be gratefully received. > 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). -mike > Cheers, > > Bradley. > > > ---------------------------(end of > broadcast)--------------------------- TIP 8: explain analyze is your > friend -- Mike Glover Key ID BFD19F2C <mpg4@duluoz.net>