Observation: Use of NOT Predicate

Generally, the Db2 optimizer will not use an index with a negated predicate. This occurs because, logically, a negated predicate does not narrow the search to a small enough result set: the entire set of values must be searched to determine which do not qualify. This is true for other negated predicates, including NOT IN, NOT BETWEEN, and NOT LIKE.

You can transform some negated range predicates into positive predicates. For example, the statement below includes a NOT operator (¬) for a less than (<) predicate:

SELECT
C1 
FROM 
T1 
WHERE 
C3 ¬< 7 

You can recode that statement using a greater than or equal to predicate (>=), as shown below:

SELECT
C1 
FROM 
T1 
WHERE 
C3 >= 7 

Note: This Observation is generated for statements containing either "NOT" or "¬".