From: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | "Richard Ray" <rray(at)mstc(dot)state(dot)ms(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How to influence the planner |
Date: | 2007-09-04 14:11:18 |
Message-ID: | dcc563d10709040711k42c113b0md21f02c4281ade95@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 8/31/07, Richard Ray <rray(at)mstc(dot)state(dot)ms(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bryce Nesbitt | 2007-09-04 14:40:04 | Re: Partial index on boolean - Sometimes fails to index scan |
Previous Message | Bart Degryse | 2007-09-04 12:09:59 | Re: Use of delete...returning in function problem |