Observation: Column Function Contains Expression

You coded an expression as an argument to a column function. This requires DB2 to resolve the expression for each column value it processes. If possible, consider moving the expression out of the column function argument, and apply the expression to the result of the column function.

The example below sums the values of column C1 and divides the result by 12:

SELECT 
SUM(C1 / 12) 
FROM 
T1 

As presently coded, this statement requires DB2 to calculate the value of expression C1 / 12 for each row in T1 while applying the SUM column function to the expression's result set. If you recode that statement as shown in the following example, DB2 calculates the sum of the values in C1 once, and then divides that atomic value by 12:

SELECT 
SUM(C1) / 12 
FROM 
T1