pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ogden <lists@darkstatic.com>
To: Greg Smith <greg@2ndquadrant.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query much faster with enable_seqscan=0
Date: Tue, 21 Sep 2010 14:34:42 -0500
Message-ID: <D551B381-C707-43C1-A3F5-A3064F09152C@darkstatic.com> (raw)
In-Reply-To: <4C9904A9.5080301@2ndquadrant.com>
References: <0D5B9ED0-00C3-4EEB-8336-0B2F8A884620@darkstatic.com>
	<20100921180618.GI17152@aart.is.rice.edu>
	<D707045F-C689-403A-9729-8DBCC39F53A1@darkstatic.com>
	<4C98FEA2.8030607@krogh.cc>
	<3062DF4E-7460-4487-818A-BF77F176E501@darkstatic.com>
	<1285096031.15919.68.camel@jd-desktop.unknown.charter.com>
	<4C9904A9.5080301@2ndquadrant.com>


On Sep 21, 2010, at 2:16 PM, Greg Smith wrote:

> Joshua D. Drake wrote:
>> PostgreSQL's defaults are based on extremely small and some would say
>> (non production) size databases. As a matter of course I always
>> recommend bringing seq_page_cost and random_page_cost more in line.
>>  
> 
> Also, they presume that not all of your data is going to be in memory, and the query optimizer needs to be careful about what it does and doesn't pull from disk.  If that's not the case, like here where there's 8GB of RAM and a 7GB database, dramatic reductions to both seq_page_cost and random_page_cost can make sense.  Don't be afraid to think lowering below 1.0 is going too far--something more like 0.01 for sequential and 0.02 for random may actually reflect reality here.
> 

I have done just that, per your recommendations and now what took 14 seconds, only takes less than a second, so it was certainly these figures I messed around with. I have set:

seq_page_cost = 0.01           
random_page_cost = 0.02   
cpu_tuple_cost = 0.01

Everything seems to run faster now. I think this should be fine - I'll keep an eye on things over the next few days. 

I truly appreciate everyone's help. 

Ogden




view thread (16+ messages)  latest in thread

Message-ID: <D551B381-C707-43C1-A3F5-A3064F09152C@darkstatic.com>
Permalink:  ../D551B381-C707-43C1-A3F5-A3064F09152C@darkstatic.com/
Also on:    postgresql.org/message-id/D551B381-C707-43C1-A3F5-A3064F09152C@darkstatic.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: lists@darkstatic.com, greg@2ndquadrant.com
  Subject: Re: Query much faster with enable_seqscan=0
  In-Reply-To: <D551B381-C707-43C1-A3F5-A3064F09152C@darkstatic.com>
  References: <0D5B9ED0-00C3-4EEB-8336-0B2F8A884620@darkstatic.com> <20100921180618.GI17152@aart.is.rice.edu> <D707045F-C689-403A-9729-8DBCC39F53A1@darkstatic.com> <4C98FEA2.8030607@krogh.cc> <3062DF4E-7460-4487-818A-BF77F176E501@darkstatic.com> <1285096031.15919.68.camel@jd-desktop.unknown.charter.com> <4C9904A9.5080301@2ndquadrant.com> <D551B381-C707-43C1-A3F5-A3064F09152C@darkstatic.com>

* 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