I was doing some performance tuning and came upon and interesting case. It had do do with case statements. What I found was regardless if the true portion of the case was found, the not true portions are executed as well. For me, this is causing performance and load issues I had not realized was the case....
take my simple example:
values ( case when current date=current date then 1 else (select count(*) from schema.bigTable) end );
In the statement above, the value returned is 1 because current date will always = current date. If you run this statement, the count in the else will be executed regardless of the fact if the statement above is true. Assuming you use a relatively big table, the case is obvious. I find this counter intuitive as there is no reason to execute the statement in the else. The above was tested on both 10.1 and 10.5 versions of LUW DB2.
I think IBM would be interested in how you prove this happening. From my recollection it was taught by all the big name speakers in paid classes and user group meetings was to code your most frequently occurring conditions at the beginning of your case statement as it breaks out of the case as soon as a condition evaluates as true.