You can improve how DB2® processes
SQL statements by following certain practices when writing predicates.
Procedure
To use predicates most efficiently
in SQL statements:
- Use stage 1 predicates whenever possible. Stage
1 predicates are better than stage 2 predicates because they disqualify
rows earlier and reduce the amount of processing that is needed at
stage 2. In terms of resource usage, the earlier a predicate is evaluated,
the better.
- Write queries to evaluate the most restrictive predicates
first. When predicates with a high filter factor are processed
first, unnecessary rows are screened as early as possible, which can
reduce processing cost at a later stage. However, a predicate's restrictiveness
is only effective among predicates of the same type and at the same
evaluation stage.