Re: Slow query problem

From: Mike Glover <mpg4(at)duluoz(dot)net>
To: Bradley Tate <btate(at)objectmastery(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow query problem
Date: 2004-01-09 03:27:16
Message-ID: 20040108192716.26c4b369.mpg4@duluoz.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 08 Jan 2004 16:52:05 +1100
Bradley Tate <btate(at)objectmastery(dot)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(at)duluoz(dot)net>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Seum-Lim Gan 2004-01-09 04:19:53 PostgreSQL vs. Oracle disk space usage
Previous Message Rod Taylor 2004-01-09 03:16:49 Re: optimizing Postgres queries