pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedUnderstanding explains
3+ messages / 2 participants
[nested] [flat]
* Understanding explains
@ 2004-10-11 21:04 Francisco Reyes <lists@natserv.com>
0 siblings, 1 reply; 3+ messages in thread
From: Francisco Reyes @ 2004-10-11 21:04 UTC (permalink / raw)
To: pgsql-performance
Is there a tutorial or reference to the different terms that appear on the
explain output?
Items such as "Nested Loop", "Hash"..
Also is there a way to easily tell which of two explains is "worse".
Example I am running a query with "set enable_seqscan to off;" and i see
the explain now shows index scans, but not sure if is any faster now.
I tried "explain analyze" and the "total runtime" for the one with
seq_scan off was faster, but after repeathing them they both dropped in
time, likely due to data getting cached. Even after the time drops for
both the one with seqscan off was always faster.
Is there any disadvantage of having the enable_seqscan off?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Understanding explains
@ 2004-10-11 22:03 Rosser Schwarz <rosser.schwarz@gmail.com>
parent: Francisco Reyes <lists@natserv.com>
0 siblings, 1 reply; 3+ messages in thread
From: Rosser Schwarz @ 2004-10-11 22:03 UTC (permalink / raw)
To: Francisco Reyes <lists@natserv.com>; +Cc: pgsql-performance
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Understanding explains
@ 2004-10-12 04:59 Francisco Reyes <lists@natserv.com>
parent: Rosser Schwarz <rosser.schwarz@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Francisco Reyes @ 2004-10-12 04:59 UTC (permalink / raw)
To: Rosser Schwarz <rosser.schwarz@gmail.com>; +Cc: pgsql-performance
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-10-12 04:59 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 21:04 Understanding explains Francisco Reyes <lists@natserv.com>
2004-10-11 22:03 ` Rosser Schwarz <rosser.schwarz@gmail.com>
2004-10-12 04:59 ` Francisco Reyes <lists@natserv.com>
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