pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Glover <mpg4@duluoz.net>
To: Bradley Tate <btate@objectmastery.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow query problem
Date: Thu, 8 Jan 2004 19:27:16 -0800
Message-ID: <20040108192716.26c4b369.mpg4@duluoz.net> (raw)
In-Reply-To: <3FFCF005.70108@objectmastery.com>
References: <3FFCF005.70108@objectmastery.com>

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>

view thread (11+ messages)  latest in thread

Message-ID: <20040108192716.26c4b369.mpg4@duluoz.net>
Permalink:  ../20040108192716.26c4b369.mpg4@duluoz.net/
Also on:    postgresql.org/message-id/20040108192716.26c4b369.mpg4@duluoz.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mpg4@duluoz.net, btate@objectmastery.com
  Subject: Re: Slow query problem
  In-Reply-To: <20040108192716.26c4b369.mpg4@duluoz.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox