Using non-column expressions efficiently
Db2 can evaluate certain predicates at an earlier stage of processing called stage 1, so that the query that contains the predicate takes less time to run. When a predicate contains column and non-column expressions on the same side of the operator, Db2 must evaluate the predicate at a later stage.
Procedure
To enable stage 1 processing of queries
that contain non-column expressions:
Example
The following predicate combines a column, SALARY, with values that are not from columns on one side of the operator:
WHERE SALARY + (:hv1 * SALARY) > 50000
If you rewrite the predicate in the following way, Db2 can evaluate it more efficiently:
WHERE SALARY > 50000/(1 + :hv1)
In
the second form, the column is by itself on one side of the operator,
and all the other values are on the other side of the operator. The
expression on the right is called a non-column expression.