I have a stored procedure that wraps a moderately complex query over 5,
6 related tables. The performance of the procedure is unacceptably slow
as it takes on average 5-10 min to complete.
To diagnose the problem, I copied the query in db2 command editor, and
substituted the procedure parameters that appear in the query with
fixed values with intention to locate the parts that are slowing it
down. However when I run the query unmodified it returns almost
instantaneously (while calling the procedure with the same parameters
takes 10mins, and with btw no records returned).
I am expecting that a query inside a stored procedure would only run
faster then an ad-hoc one.
I am running DB2 8.2 on Linux.
Does anybody have an idea on what might be wrong there?
Thanks
Nesa