Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 2A0119F9BAC for ; Tue, 4 Sep 2007 12:56:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 55019-05 for ; Tue, 4 Sep 2007 12:56:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from itspmx51.state.ms.us (relay.ms.gov [205.144.225.177]) by postgresql.org (Postfix) with ESMTP id AA97E9F9606 for ; Tue, 4 Sep 2007 12:56:06 -0300 (ADT) Received: from itspmx51.state.ms.us (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id A613E5B1D for ; Mon, 4 Sep 2000 10:55:55 -0500 (CDT) Received: from rray.drdc.mstc.ms.gov (unknown [10.3.192.2]) by itspmx51.state.ms.us (Postfix) with ESMTP id 95FDC5B11 for ; Mon, 4 Sep 2000 10:55:55 -0500 (CDT) Received: from rray.drdc.mstc.ms.gov (localhost.localdomain [127.0.0.1]) by rray.drdc.mstc.ms.gov (8.13.8/8.13.8) with ESMTP id l84Fu5vV018662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 4 Sep 2007 10:56:05 -0500 Received: from localhost (rray@localhost) by rray.drdc.mstc.ms.gov (8.13.8/8.13.8/Submit) with ESMTP id l84Fu5q0018658 for ; Tue, 4 Sep 2007 10:56:05 -0500 X-Authentication-Warning: rray.drdc.mstc.ms.gov: rray owned process doing -bs Date: Tue, 4 Sep 2007 10:56:04 -0500 (CDT) From: Richard Ray X-X-Sender: rray@rray.drdc.mstc.ms.gov To: pgsql-sql@postgresql.org Subject: Re: How to influence the planner In-Reply-To: Message-ID: References: <373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net> <2005.1188596277@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: ClamAV 0.91.1/4153/Tue Sep 4 09:55:20 2007 on rray.drdc.mstc.ms.gov X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/40 X-Sequence-Number: 29253 Thanks guys Lesson learned On Tue, 4 Sep 2007, Scott Marlowe wrote: > On 8/31/07, Richard Ray wrote: > >> Changing to enable_seqscan = on does solve this problem, thanks >> Is there some method of crafting a query that will assert my wishes to the planner >> When is enable_seqscan = off appropriate > > enable_xxx = off are troubleshooting tools. They override the query planner. > > For instance, I had a query that was running slow, and using set > enable_nestloop=off allowed the query to run fast. However, using > explain analyze I could see that the estimated number of rows was off. > Analyze didn't fix it, so I increased the stats target for the column > I was working with, reanalyzed, and voila, the query ran fine with > nestloop=on. > > So, enable_xxx=off is normally only appropriate when troubleshooting > an issue, not as a fix all. That's doubly true for > enable_seqscan=off. > > If you do have a query that nothing else seems to work on it, you can > set one of the enable_xxx settings off for that connection only and > not worry about messing up all the other sessions connecting to your > db. >