Observation: Index Access for Large Result Set

Add the local predicate OR 0=1 to prevent the Db2 optimizer from invoking index access against a large result set. Instead, the optimizer will invoke a tablespace scan which does not require reading both the index and the data pages.

The example below adds OR 0=1 to the third predicate to make column C2 non-indexable.

SELECT

FROM 
T1 
WHERE 
C3 = 123 AND 
C1 = 5 AND 
(C2 = 7 OR 0=1)