Influencing access path selection
You can influence the access paths that DB2® uses to process SQL statements.
Before you begin
- Prepare to influence access paths.
- Create any input tables that are required.
- The following methods for influencing access path selection are best applied in exception cases, when normal access path selection results in efficient access paths. Before applying any of these methods, first take the following actions:
About this task
When you apply any of the following methods to influence access path selection, DB2 uses information that you provide during access path selection. For static SQL statements, DB2 validates and uses the information when you rebind the package that contains the statements. For dynamic SQL statements, DB2 applies, validates, and uses the information when the statements are prepared.
You can use the BIND QUERY command to
influence access path selection at the statement level. When you use these methods, DB2 applies the information for SQL statements that match the statement text
you specify, in any of the following contexts:
- System-wide
- From any version of particular collection and package
- From a particular version of a collection and package
You can also insert values in a PLAN_TABLE instance to specify access paths.
Procedure
To influence the access path selection for SQL statements, use any of the following approaches: