Skip site navigation (1) Skip section navigation (2)

Re: Explain not accurate

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Richard van den Berg <richard(dot)vandenberg(at)trust-factory(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Explain not accurate
Date: 2004-01-12 02:55:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Richard van den Berg <richard(dot)vandenberg(at)trust-factory(dot)com> writes:

> Hi there,
> I am quite new to postgresql, and love the explain feature. It enables us to
> predict which SQL queries needs to be optimized before we see any problems.
> However, I've run into an issue where explain tells us a the costs of a quiry
> are tremendous (105849017586), but the query actually runs quite fast. Even
> "explain analyze" shows these costs.

Do you have any of the optimization parameters off, enable_seqscan perhaps?

enable_seqscan works by penalizing plans that use sequential plans, but there
are still lots of queries that cannot be done any other way. I'm not sure
whether the same holds for all the other parameters.

If your tables are all going to grow drastically then this may still indicate
a problem, probably a missing index. But if one of them is a reference table
that will never grow then perhaps the index will never be necessary.

Or perhaps you just need to run analyze. Send the "EXPLAIN ANALYZE" output for
the query for starters. You might also send the output of "SHOW ALL".


In response to

pgsql-performance by date

Next:From: Andrew RawnsleyDate: 2004-01-12 03:05:11
Subject: annoying query/planner choice
Previous:From: Christopher Kings-LynneDate: 2004-01-12 00:38:23
Subject: Re: COUNT & Pagination

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group