Observation: Correlated Subquery uses EXISTS or NOT EXISTS

You coded a subquery using EXISTS or NOT EXISTS predicates. If the subquery is a correlated subquery, the Db2 optimizer will not consider access through an available index.

The following example includes a correlated subquery using EXISTS:

SELECT * A.empno, A.lastname, A.firstname 
FROM T1 A 
WHERE EXISTS 
(SELECT * FROM T2 B 
WHERE B.empno = A.empno); 

Consider recoding the correlated subquery as a JOIN and referencing any indexed columns:

SELECT A.empno, A.lastname, A.firstname FROM T1 A, T2 B 
WHERE A.empno = B.empno;