Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 6E0F163311F for ; Tue, 3 Nov 2009 13:54:35 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01165-07 for ; Tue, 3 Nov 2009 17:54:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 5BC06633918 for ; Tue, 3 Nov 2009 13:54:21 -0400 (AST) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Tue, 03 Nov 2009 11:54:20 -0600 Message-Id: <4AF019E6020000250002C1D2@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.0 Date: Tue, 03 Nov 2009 11:54:14 -0600 From: "Kevin Grittner" To: "Jeff Janes" Cc: "Grant Masan" , Subject: Re: Problem with database performance, Debian 4gb ram ? References: <4AEFF447020000250002C19D@gw.wicourts.gov> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-6.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4 X-Spam-Level: X-Archive-Number: 200911/25 X-Sequence-Number: 36193 Jeff Janes wrote: > On Tue, Nov 3, 2009 at 7:13 AM, Kevin Grittner > wrote: >> Grant Masan 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