pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Richard Ray <rray@mstc.state.ms.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to influence the planner
Date: Tue, 4 Sep 2007 09:11:18 -0500
Message-ID: <dcc563d10709040711k42c113b0md21f02c4281ade95@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0708311856550.7540@rray.drdc.mstc.ms.gov>
References: <Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov>
	<373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net>
	<Pine.LNX.4.64.0708311557140.17749@rray.drdc.mstc.ms.gov>
	<2005.1188596277@sss.pgh.pa.us>
	<Pine.LNX.4.64.0708311856550.7540@rray.drdc.mstc.ms.gov>

On 8/31/07, Richard Ray <rray@mstc.state.ms.us> 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.



view thread (10+ messages)  latest in thread

Message-ID: <dcc563d10709040711k42c113b0md21f02c4281ade95@mail.gmail.com>
Permalink:  ../dcc563d10709040711k42c113b0md21f02c4281ade95@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10709040711k42c113b0md21f02c4281ade95@mail.gmail.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: scott.marlowe@gmail.com, rray@mstc.state.ms.us
  Subject: Re: How to influence the planner
  In-Reply-To: <dcc563d10709040711k42c113b0md21f02c4281ade95@mail.gmail.com>

* 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