Skip site navigation (1) Skip section navigation (2)

Re: Between Node

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>,Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 20:40:18
Message-ID: 8661.1027024818@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Rod Taylor <rbt(at)zort(dot)ca> writes:
>> In that case, this code is worse than before as far as developing plans
>> goes.  The selectivity estimator needs to be taught about what BETWEEN
>> means.  Currently it recognizes (x > foo AND x < bar) as a range query
>> --- a BETWEEN node is obviously much easier to recognize, but you still
>> have to add code to do it.

> I simply multiple the results of the left, right and common expression
> after sending them through clause_selectivity() ?

Huh?  I don't see any "common expression" here.  You've got a left
comparison and a right comparison.

Actually, at least for the case of the standard asymmetric BETWEEN
clause, you really really want to be able to generate a bounded
indexscan plan (indexscan with x > foo AND x < bar as indexquals).
That used to happen for free, and now will not happen at all, because
BETWEEN is not in the set of operators recognized as indexscannable
operators.  Not sure what the most appropriate fix is --- there are a
number of places that we could try to fix it at, with varying
implications as to the amount of code changed and the generality of
the cases handled.

			regards, tom lane

In response to

pgsql-patches by date

Next:From: Joe ConwayDate: 2002-07-18 22:00:21
Subject: small psql patch - show Schema name for \dt \dv \dS
Previous:From: Bruce MomjianDate: 2002-07-18 20:36:56
Subject: Re: Fix for regression caused by heap tuple header changes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group