Re: Slow query problem - Mailing list pgsql-performance

From Mike Glover
Subject Re: Slow query problem
Date
Msg-id 20040108192716.26c4b369.mpg4@duluoz.net
Whole thread Raw
In response to Slow query problem  (Bradley Tate <btate@objectmastery.com>)
Responses Re: Slow query problem
Re: Slow query problem
List 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>

Attachment

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: optimizing Postgres queries
Next
From: Seum-Lim Gan
Date:
Subject: PostgreSQL vs. Oracle disk space usage