Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6C2B6632406 for ; Wed, 4 Aug 2010 11:01:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 53593-02 for ; Wed, 4 Aug 2010 14:01:41 +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 778B4632400 for ; Wed, 4 Aug 2010 11:01:43 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 04 Aug 2010 09:01:41 -0500 Message-Id: <4C592C6F02000025000341BA@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 04 Aug 2010 09:01:34 -0500 From: "Kevin Grittner" To: "Peter Hussey" Cc: "pgsql-performance" Subject: Re: Questions on query planner, join types, and work_mem References: <18551.1280275502@sss.pgh.pa.us> <25534.1280498632@sss.pgh.pa.us> 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=-1.51 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/42 X-Sequence-Number: 39885 Peter Hussey wrote: > I already had effective_cache_size set to 500MB. That seems awfully small. You do realize that this setting does not cause PostgreSQL to allocate any memory; it merely advises how much disk space is likely to be cached. It should normally be set to the sum of your shared_buffers setting and whatever your OS reports as cached. Setting it too small will discourage the optimizer from picking plans which use indexes. > I experimented with lowering random_page_cost to 3 then 2. As others have said, in a fully cached system that's still too high. If the active portion of your database is fully cached, you should set random_page_cost and seq_page_cost to the same value, and that value should probably be in the range of 0.1 to 0.005. It can get trickier if the active portion is largely but not fully cached; we have one server where we found, through experimentation, that we got better plans overall with seq_page_cost = 0.3 and random_page_cost = 0.5 than any other settings we tried. -Kevin