pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Siva Kumar <tech@leatherlink.net>
To: pgsql-general@postgresql.org
Subject: Re: Query optimization
Date: Fri, 4 Oct 2002 14:29:51 +0100
Message-ID: <200210041429.51956.dev@archonet.com> (raw)
In-Reply-To: <200210041756.35489.tech@leatherlink.net>
References: <200210041347.55055.tech@leatherlink.net>
	<200210041114.17241.dev@archonet.com>
	<200210041756.35489.tech@leatherlink.net>

On Friday 04 Oct 2002 1:26 pm, Siva Kumar wrote:
> Giving below the output of EXPLAIN ANALYSE. I could not make much sense out
> of it, please help!

Scary aren't they ;-)

The important thing is you've got plenty of "Index Scan"s rather than Seq 
Scans. The other point is the final time:

> Total runtime: 5.45 msec

Now, since that's not what you're getting, I'd think Neil (see other reply) is 
right and you need to look at issuing "SET geqo = off;" before the query.

Postgresql has a genetic algorithm that kicks in on what it thinks is a very 
complex query, this can take a long time to analyse the options available but 
pays dividends on a big query. In your case you're only getting a few rows 
and so it takes longer to analyse than to get the results.

The other thing that might work is rewriting the query with explicit JOINs - I 
think that should make it clear to Postgresql what order to do things in.

- Richard Huxton



view thread (48+ messages)  latest in thread

Message-ID: <200210041429.51956.dev@archonet.com>
Permalink:  ../200210041429.51956.dev@archonet.com/
Also on:    postgresql.org/message-id/200210041429.51956.dev@archonet.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-general@postgresql.org
  Cc: dev@archonet.com, tech@leatherlink.net
  Subject: Re: Query optimization
  In-Reply-To: <200210041429.51956.dev@archonet.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