pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Langille <dan@langille.org>
To: Rod Taylor <ports@rbt.ca>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: seq scan woes
Date: Mon, 07 Jun 2004 17:02:36 -0400
Message-ID: <40C49FAC.11805.49212810@localhost> (raw)
In-Reply-To: <1086640698.86807.61.camel@jester>
References: <40C493F8.1181.48F37175@localhost>

On 7 Jun 2004 at 16:38, Rod Taylor wrote:

> On Mon, 2004-06-07 at 16:12, Dan Langille wrote:
> > On 7 Jun 2004 at 16:00, Rod Taylor wrote:
> > 
> > > On Mon, 2004-06-07 at 15:45, Dan Langille wrote:
> > > > A production system has had a query recently degrade in performance.  
> > > > What once took < 1s now takes over 1s.  I have tracked down the 
> > > > problem to a working example.
> > > 
> > > What changes have you made to postgresql.conf?
> > 
> > Nothing recently (ie. past few months). Nothing at all really.  
> > Perhaps I need to start tuning that.
> > 
> > > Could you send explain analyse again with SEQ_SCAN enabled but with
> > > nested loops disabled?
> > 
> > See http://rafb.net/paste/results/zpJEvb28.html
> 
> This doesn't appear to be the same query as we were shown earlier.

My apologies. I should try to cook dinner and paste at the same time. 
 ;)

http://rafb.net/paste/results/rVr3To35.html is the right query.

> > > Off the cuff? I might hazard a guess that effective_cache is too low or
> > > random_page_cost is a touch too high. Probably the former.
> > 
> > I grep'd postgresql.conf:
> > 
> > #effective_cache_size = 1000    # typically 8KB each
> > #random_page_cost = 4           # units are one sequential page fetch cost
> 
> This would be the issue. You haven't told PostgreSQL anything about your
> hardware. The defaults are somewhat modest.
> 
> http://www.postgresql.org/docs/7.4/static/runtime-config.html
> 
> Skim through the run-time configuration parameters that can be set in
> postgresql.conf.
> 
> Pay particular attention to:
>       * shared_buffers (you may be best with 2000 or 4000)
>       * effective_cache_size (set to 50% of ram size if dedicated db
>         machine)
>       * random_page_cost (good disks will bring this down to a 2 from a
>         4)

I'll have a play with that and report back.

Thanks.
-- 
Dan Langille : http://www.langille.org/
BSDCan - http://www.bsdcan.org/




view thread (7+ messages)  latest in thread

Message-ID: <40C49FAC.11805.49212810@localhost>
Permalink:  ../40C49FAC.11805.49212810@localhost/
Also on:    postgresql.org/message-id/40C49FAC.11805.49212810@localhost

 · 

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: dan@langille.org, ports@rbt.ca
  Subject: Re: seq scan woes
  In-Reply-To: <40C49FAC.11805.49212810@localhost>

* 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