
Stabilizing access paths for dynamic SQL statements
You can stabilize the access paths for repeating cached dynamic SQL statements to gain performance stability characteristics similar to applications that use static SQL statements.
Before you begin
Set the value of the CACHEDYN_STABILIZATION subsystem parameter to an appropriate value. For more information, see CACHE DYN STABILITY field (CACHEDYN_STABILIZATION subsystem parameter).
Observe the dynamic statement cache to identify statements that are likely to be captured for stabilization, as described in Identifying dynamic SQL statements to stabilize.
About this task
When you stabilize dynamic SQL statements, Db2 stores current SQLID, statement text, and runtime structures for stabilized dynamic SQL statements in certain Db2 catalog tables. When a cache miss occurs for a stabilized dynamic SQL statement, Db2 loads the cache structures from the catalog instead of processing a full prepare for the statement.
Procedure
To stabilize access paths for dynamic SQL statements:
What to do next
Take any of the following actions:
- Issue DISPLAY DYNQUERYCAPTURE commands to identify dynamic SQL statements that are being monitored for stabilization.
- Issue STOP DYNQUERYCAPTURE commands to stop the monitoring and capture of dynamic SQL statements.
- Establish a process for checking for stabilized dynamic SQL statements that are no longer used, to reclaim the storage space used in the Db2 catalog by such statements.
When you are ready to get a new access path or reclaim catalog storage for stabilized dynamic SQL statements, issue a FREE STABILIZED DYNAMIC QUERY command, as described in Removing stabilized dynamic SQL statements from the Db2 catalog.
