pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Kirkwood <markir@coretech.co.nz>
Cc: Litao Wu <litaowu@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgres Optimizer is not smart enough?
Date: Thu, 13 Jan 2005 10:24:11 -0500
Message-ID: <9156.1105629851@sss.pgh.pa.us> (raw)
In-Reply-To: <41E63917.2070906@coretech.co.nz>
References: <20050112222506.32084.qmail@web13124.mail.yahoo.com>
	<41E5AF3F.2080100@coretech.co.nz>
	<4337.1105583973@sss.pgh.pa.us>
	<41E63917.2070906@coretech.co.nz>

Mark Kirkwood <markir@coretech.co.nz> writes:
> Hmmm ... so it's only the selectivity that is the same (sourced from
> index->amcostestimate which I am guessing points to btcostestimate), is
> that correct?

No, the point is that btcostestimate will compute not only the same
selectivities but the identical index access cost values, because it
thinks that only one index entry will be fetched in both cases.  It
needs to account for the fact that the inequality condition will cause a
scan over a larger range of the index than is actually returned.  See
_bt_preprocess_keys() and _bt_checkkeys().

The small differences you are showing have to do with different
assumptions about where the now() function will get evaluated (once per
row or once at scan start).  That's not the effect that I'm worried
about.

			regards, tom lane



view thread (8+ messages)

Message-ID: <9156.1105629851@sss.pgh.pa.us>
Permalink:  ../9156.1105629851@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9156.1105629851@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, markir@coretech.co.nz, litaowu@yahoo.com
  Subject: Re: Postgres Optimizer is not smart enough?
  In-Reply-To: <9156.1105629851@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