Adding extra predicates to improve access paths

By adding extra predicates to a query, you might enable Db2 to take advantage of more efficient access paths.

About this task

Begin program-specific programming interface information.Db2 performs predicate transitive closure only on equal and range predicates. However, you can help Db2 to choose a better access path by adding transitive closure predicates for other types of operators, such as LIKE.

Example

For example, consider the following SELECT statement:

SELECT * FROM T1,T2
   WHERE T1.C1=T2.C1
     AND T1.C1 LIKE 'A

If T1.C1=T2.C1 is true, and T1.C1 LIKE 'A%' is true, then T2.C1 LIKE 'A%' must also be true. Therefore, you can give Db2 extra information for evaluating the query by adding T2.C1 LIKE 'A%':

SELECT * FROM T1,T2
   WHERE T1.C1=T2.C1
     AND T1.C1 LIKE 'A%'
     AND T2.C1 LIKE 'A
End program-specific programming interface information.