pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: pgsql-performance@postgresql.org
Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan
Date: Fri, 25 Nov 2005 09:32:00 -0300
Message-ID: <20051125123200.GD14707@surnet.cl> (raw)
In-Reply-To: <20051125114017.GA10575@uio.no>
References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com>
	<A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com>
	<17380.1132886273@sss.pgh.pa.us>
	<438681E0.6070006@kylecordes.com>
	<20051125114017.GA10575@uio.no>

Steinar H. Gunderson wrote:
> On Thu, Nov 24, 2005 at 09:15:44PM -0600, Kyle Cordes wrote:
> > I have hit cases where I have a query for which there is a somewhat 
> > "obvious" (to a human...) query plan that should make it possible to get 
> > a query answer pretty quickly.  Yet the query "never" finishes (or 
> > rather, after hours of waiting I finally kill it).  I assume this is 
> > because of a sub-optimal query plan.  But, it appears that an EXPLAIN 
> > ANALYZE runs the actual query, so it takes as long as the actual query.
> 
> In this case, you probably can't do better than EXPLAIN. Look at the
> estimates, find out if the cost is way high somewhere.

Also you want to make absolutely sure all the involved tables have been
ANALYZEd recently.

If you have weird cases where there is an obvious query plan and the
optimizer is not using it, by all means submit it so that developers can
take a look at how to improve the optimizer.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



view thread (12+ messages)  latest in thread

Message-ID: <20051125123200.GD14707@surnet.cl>
Permalink:  ../20051125123200.GD14707@surnet.cl/
Also on:    postgresql.org/message-id/20051125123200.GD14707@surnet.cl

 · 

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: alvherre@commandprompt.com
  Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan
  In-Reply-To: <20051125123200.GD14707@surnet.cl>

* 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