pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marc Mitchell <marcm@eisolution.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Query performanc issue - too many table?
Date: Thu, 21 Nov 2002 18:56:54 -0500
Message-ID: <18616.1037923014@sss.pgh.pa.us> (raw)
In-Reply-To: <00c101c291a1$9b99b820$7c01050a@marcmdelltop>
References: <E26F84170D88D411B4AA002035AE9F0D03C0A174@lclntmx4.ngco.com>
	<005501c2917f$61ca09a0$7c01050a@marcmdelltop>
	<13938.1037907911@sss.pgh.pa.us>
	<00c101c291a1$9b99b820$7c01050a@marcmdelltop>

> The attached output is from 3 consecutive EXPLAIN ANALYSEs of the exact
> same query.  Each has a merge join floating somewhere within the query.
> This has to be the culprit in terms of performance as this should be a
> straightforward (albeit lengthy) step ladder keyed join query.

It's not the merge join's fault; it's a question of a poorly chosen join
order.  I'm kinda surprised that GEQO didn't manage to find a better
one, but your example shows that its odds of doing so aren't very good
in this example.  (I wonder whether GEQO shouldn't be augmented with
some heuristics, so that it pays some attention to which relations have
WHERE-clause links to which other ones, or restriction clauses that
would make them useful to visit first.  Right now I think it's a pretty
blind search...)

> So, is GEQC broken or just misconfigured on our box?  If the latter, what
> is the proper config?  We've made no changes from the default settings?  If
> the former, can I simply shut it off?  Is the only time this comes into
> play equate to the number of times I see the debug message appear in the
> postmaster log?

I wouldn't shut it off.  I would suggest raising the geqo_threshold a
little bit, if you do a lot of 11-table joins, and you don't find the
planning time unreasonable at 11 tables.

Another possibility is to use explicit JOIN syntax to constrain the join
order into a good one; that would save you planning time as well.  See
the manual.

			regards, tom lane



view thread (5+ messages)

Message-ID: <18616.1037923014@sss.pgh.pa.us>
Permalink:  ../18616.1037923014@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18616.1037923014@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, marcm@eisolution.com
  Subject: Re: Query performanc issue - too many table?
  In-Reply-To: <18616.1037923014@sss.pgh.pa.us>
  References: <E26F84170D88D411B4AA002035AE9F0D03C0A174@lclntmx4.ngco.com> <005501c2917f$61ca09a0$7c01050a@marcmdelltop> <13938.1037907911@sss.pgh.pa.us> <00c101c291a1$9b99b820$7c01050a@marcmdelltop> <18616.1037923014@sss.pgh.pa.us>

* 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