Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 9D0329FB1DF for ; Wed, 27 Sep 2006 17:14:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 20962-06 for ; Wed, 27 Sep 2006 20:13:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 98EC69FA21B for ; Wed, 27 Sep 2006 17:13:52 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 2D7E456441; Wed, 27 Sep 2006 15:13:51 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Wed, 27 Sep 2006 15:13:50 -0500 Date: Wed, 27 Sep 2006 15:13:50 -0500 From: "Jim C. Nasby" To: Dave Dutcher Cc: 'Tim Truman' , pgsql-performance@postgresql.org Subject: Re: Forcing the use of particular execution plans Message-ID: <20060927201350.GS19827@nasby.net> References: <000501c6e1ff$c80022c0$0340050a@sdg> <007b01c6e24c$ccfc8190$8300a8c0@tridecap.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <007b01c6e24c$ccfc8190$8300a8c0@tridecap.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060927:dave@tridecap.com::RS0RuGFVc3rgKtsE:00000000000000000000 0000000000000000000000005NlJ X-Hashcash: 1:20:060927:tim@advam.com::qwAA6zsHrLbAaRde:00002IEx X-Hashcash: 1:20:060927:pgsql-performance@postgresql.org::98H0mMJK7Ix08Z60:00000 0000000000000000000000000BqP X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200609/370 X-Sequence-Number: 21056 On Wed, Sep 27, 2006 at 10:51:26AM -0500, Dave Dutcher wrote: > To make the planner prefer an index scan over a seq scan, I would first > check the statistics again, and then you can try setting enable_seqscan to > false (enable_seqscan is meant more for testing than production) or, you > could try reducing random_page_cost, but you should test that against a > range of queries before putting it in production. Index scans are also pretty picky about correlation. If you have really low correlation you don't want to index scan, but I think our current estimates make it too eager to switch to a seqscan. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)