Quote:
|
Originally Posted by Dracofrank
Hello and thanks in advance,
I am trying to log queries of my app by using an event monitor. The app works fine without errors and producing correct results. Unfortunately, my event monitor only gives queries with question marks, like "select * from address where addr_id = ?" instead of replacing with placeholder. Using a dynamic sql snapshop also gives the same result. Why??
|
These are prepared statements. That is the way your applicaiton submits them. There is a big advantage to this in that the statement is compiled only once and the access plan (package) is stored in package cache for reuse over and over again without recompiling.
If your application did not use prepared statements, then the SQL would have to be compiled each time it is submitted (assuming the predicate values are different for each query), probably resulting in longer execution times.
You can do an explain using the parmater markers, so there is usually no serious limitation in their use in analyzing the system performance. Sometimes a query may run faster if DB2 knows the exact value of a predicate at compile time (when the package is created) but a good DBA can figure out ways to solve these problems.