pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Grant Masan <grant.massan@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Problem with database performance, Debian 4gb ram ?
Date: Tue, 03 Nov 2009 11:54:14 -0600
Message-ID: <4AF019E6020000250002C1D2@gw.wicourts.gov> (raw)
In-Reply-To: <f67928030911030923i31663c7ew8d75b04874cb568d@mail.gmail.com>
References: <c09b5d640911020616t7177a7b9sb4b5f285d99e7c05@mail.gmail.com>
	<4AEFF447020000250002C19D@gw.wicourts.gov>
	<f67928030911030923i31663c7ew8d75b04874cb568d@mail.gmail.com>

Jeff Janes <jeff.janes@gmail.com> wrote:
> On Tue, Nov 3, 2009 at 7:13 AM, Kevin Grittner
> <Kevin.Grittner@wicourts.gov> wrote:
>> Grant Masan <grant.massan@gmail.com> wrote:
>>
>>
>>> cpu_tuple_cost = 0.0030
>>> cpu_index_tuple_cost = 0.0010
>>> cpu_operator_cost = 0.0005
>>
>> Why did you make these adjustments?  I usually have to change the
>> ratio between page and cpu costs toward the other direction.
> 
> Is that because the database is mostly cached in memory?  If I take
> the documented descriptions of the costs parameters at face value, I
> find that cpu_tuple_cost should be even lower yet.
 
Right, the optimizer doesn't model caching effects very well, so I
find that in practice I have to fudge these from their putative
meanings to allow for typical caching.  Even with only a small
fraction of the database cached, the heavily accessed indexes tend to
be fairly well cached, so overall performance improves markedly by
dropping random_page_cost to about 2, even in our lowest-percentage-
cached databases.
 
I've occasionally tried using the defaults for that GUC, which has
always resulted in user complaints about unacceptable performance of
important queries.  While I tend to reduce the random_page_cost and
seq_page_cost to tweak things, raising the cpu_*_cost settings would
accomplish the same thing, so reducing them as show above would tend
to push things into sequential scans where indexed access might be
faster.
 
-Kevin



view thread (11+ messages)  latest in thread

Message-ID: <4AF019E6020000250002C1D2@gw.wicourts.gov>
Permalink:  ../4AF019E6020000250002C1D2@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4AF019E6020000250002C1D2@gw.wicourts.gov

 · 

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: Kevin.Grittner@wicourts.gov, jeff.janes@gmail.com, grant.massan@gmail.com
  Subject: Re: Problem with database performance, Debian 4gb ram ?
  In-Reply-To: <4AF019E6020000250002C1D2@gw.wicourts.gov>
  References: <c09b5d640911020616t7177a7b9sb4b5f285d99e7c05@mail.gmail.com> <4AEFF447020000250002C19D@gw.wicourts.gov> <f67928030911030923i31663c7ew8d75b04874cb568d@mail.gmail.com> <4AF019E6020000250002C1D2@gw.wicourts.gov>

* 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