pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Kirkwood <markir@ihug.co.nz>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] New Optimizer Behaviour In 7.0b1
Date: Sat, 26 Feb 2000 03:04:51 -0500
Message-ID: <26472.951552291@sss.pgh.pa.us> (raw)
In-Reply-To: <38B77942.8B5B6A85@ihug.co.nz>
References: <38B77942.8B5B6A85@ihug.co.nz>

Mark Kirkwood <markir@ihug.co.nz> writes:
> I have been using the query shown below to study optimizer changes.

> [ results snipped ]

> However it seems a bit on the brutal side to have to coerce the
> optimizer this way ( after all hash joins are generally good), is
> there any way to get a reasonably sensible use of indexes without such
> desperate measures ?

Obviously we'd like to get the optimizer to do the right thing without
being beaten over the head ;-).  As you see, we're not there yet.

I will be the first to say that the 7.0 optimizer is still in a pretty
crude state: I have made drastic changes to its model of plan costs,
and have not yet had much time to tune the results.  I do appreciate
reports about cases it gets wrong.

In this case I guess the first question to ask is whether its
selectivity estimates are any good.  It seems to be estimating that your
"d0.d0f1 between '1999-11-01' and '1999-12-01'" clause will select about
100 of the 900 rows in dim0; is that anywhere near right?  Also, in the
nested-loop plan we can see that it thinks about 1500 rows from fact1
will match on "d0.d0key = f.d0key" against any given selected row from
dim0; is that on the mark?  Finally, is the estimate that the total
number of joined rows (before GROUP BY) is about 33333 any good?

If you have not done VACUUM ANALYZE recently on these two tables,
it'd be worth trying that to see if it brings the estimates any
closer to reality.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <26472.951552291@sss.pgh.pa.us>
Permalink:  ../26472.951552291@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26472.951552291@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, markir@ihug.co.nz
  Subject: Re: [SQL] New Optimizer Behaviour In 7.0b1
  In-Reply-To: <26472.951552291@sss.pgh.pa.us>
  References: <38B77942.8B5B6A85@ihug.co.nz> <26472.951552291@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