Observation: Use of >= or <= Predicate

DB2 can evaluate both greater than or equal to (>=) and less than or equal to (<=) predicates at stage 1. However, when using values with these operators, the Db2 optimizer assigns a lower filter factor to BETWEEN than for either >= or <=. Also, the optimizer is more likely to use an index for BETWEEN.

The example below includes greater than or equal to (>=) predicate for column C3, a SMALLINT:

SELECT
C1 
FROM 
T1 
WHERE 
C3 >= 7 

You can recode that statement using a BETWEEN predicate, as shown below:

SELECT
C1 
FROM 
T1 
WHERE 
C3 BETWEEN 7 AND 32767