Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> About BETWEEN and the Optimizer

About BETWEEN and the Optimizer

From: Brian Tkatch <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK>
Date: Wed, 12 Dec 2001 18:35:34 GMT
Message-ID: <3c17a231.2001850156@news.alt.net>


Oracle 8.1.7

I am reading the documentation on optimization. Chapter 4, the Optimizer. It gives an example (6):

===

The following query uses the BETWEEN operator to select all employees with employee ID numbers between 7500 and 7800:

SELECT *
  FROM emp
  WHERE empno BETWEEN 7500 AND 7800;

To determine the selectivity of this query, the optimizer decomposes the WHERE clause condition into these two conditions:

empno >= 7500
empno <= 7800
===

This question is more out of curiosity than anything else.

Does using BETWEEN have any advantages over two separate caluses that check < and >? BETWEEN is possibly better for readability, but I am not asking about that. Does BETWEEN somehow let the optimizer tie the two WHERE clauses together where it otherwise would not?

Brian Received on Wed Dec 12 2001 - 12:35:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US