Re: Between Node - Mailing list pgsql-patches

From Tom Lane
Subject Re: Between Node
Date
Msg-id 8661.1027024818@sss.pgh.pa.us
Whole thread Raw
In response to Re: Between Node  (Rod Taylor <rbt@zort.ca>)
List pgsql-patches
Rod Taylor <rbt@zort.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

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Fix for regression caused by heap tuple header changes
Next
From: Joe Conway
Date:
Subject: small psql patch - show Schema name for \dt \dv \dS