pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Richard van den Berg <richard.vandenberg@trust-factory.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Explain not accurate
Date: 11 Jan 2004 21:55:26 -0500
Message-ID: <87smil3mg1.fsf@stark.xeocode.com> (raw)
In-Reply-To: <3FFEB6DA.8000905@trust-factory.com>
References: <3FFEB6DA.8000905@trust-factory.com>


Richard van den Berg <richard.vandenberg@trust-factory.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".

-- 
greg




view thread (4+ messages)

Message-ID: <87smil3mg1.fsf@stark.xeocode.com>
Permalink:  ../87smil3mg1.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87smil3mg1.fsf@stark.xeocode.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-performance@postgresql.org
  Cc: gsstark@mit.edu, richard.vandenberg@trust-factory.com
  Subject: Re: Explain not accurate
  In-Reply-To: <87smil3mg1.fsf@stark.xeocode.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