Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Compiler using different runstats at prepared and direct statement

$
0
0
Today I had a performance issue regarding one statement. The statement was executed through a Java program that is using JDBC by means of a prepared statement took about 70 minutes.
When capturing the query and executing it manually in an CLP took only 40ms.
After executing a runstats on the tables involved in the the query, the query executed via a prepared statement was fast again, taking only milliseconds.

The question I now have is: Does anybody know how the runstats fixed the execution time of the query that was executed by the Java program by means of a prepared statement and why a direct execution of the same query (on the same statistics) did not have such a dramatic performance?

Isn't DB2 using the same statistics when compiling a query, regardless if it is executed directly or by means of a prepared statement? :(

The DB2 database where this occured was restored on a virtual VMware test server, running Windows Server 2008. DB2 LUW AESE version 9.5 fixpack 5.

Viewing all articles
Browse latest Browse all 13329

Trending Articles