Re: [PERFORM] Understanding explains

2004-10-11 Thread Francisco Reyes
On Mon, 11 Oct 2004, Rosser Schwarz wrote:
In general, it's best to let the planner make the appropriate choice
without any artificial constraints.
As someone suggested ran with Explain analyze.
With seqscan_off was better.
Ran a vacuum analyze this afternoon so the stats were up to date.
Although I will leave the setting as it's default for most of everything I 
do, it seems that for some reason in this case it mases sense to turn it 
off.

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PERFORM] Understanding explains

2004-10-11 Thread Rosser Schwarz
while you weren't looking, Francisco Reyes wrote:

> Is there any disadvantage of having the enable_seqscan off?

Plenty.

The planner will choose whichever plan looks "cheapest", based on the
information it has available (table size, statistics, &c).  If a
sequential scan looks cheaper, and in your case above it clearly is,
the planner will choose that query plan.  Setting enable_seqscan =
false doesn't actually disable sequential scans; it merely makes them
seem radically more expensive to the planner, in hopes of biasing its
choice towards another query plan.  In your case, that margin made an
index scan look less expensive than sequential scan, but your query
runtimes clearly suggest otherwise.

In general, it's best to let the planner make the appropriate choice
without any artificial constraints.  I've seen pathalogical cases
where the planner makes the wrong choice(s), but upon analysis,
they're almost always attributable to poor statistics, long
un-vacuumed tables, &c.

/rls

-- 
:wq

---(end of broadcast)---
TIP 8: explain analyze is your friend