Capturing reoptimized access paths
Special measures are required for capturing EXPLAIN information that accurately reflects the reoptimized access path for a SQL statement when certain REOPT options are specified.
About this task
EXPLAIN
information for SQL statements that are reoptimized at run time do
not always represent the access path that DB2 uses at run time. For example, in each of
the following situations, the captured EXPLAIN information reflects
the access path that DB2 chooses
when literal values are unknown:
- For static SQL statements that use the REOPT(ALWAYS) option when EXPLAIN(YES) is specified at bind time
- For dynamic SQL statements that contain parameter markers and special registers and use the REOPT(ONCE) or REOPT(AUTO) options, when an EXPLAIN PLAN statement is issued.
Therefore, DB2 might choose a different access path at run time when the literal values are known.
Procedure
To capture EXPLAIN information that accurately reflects the access path for statements that are reoptimized at run time, use the following approaches: