SET CURRENT OPTIMIZATION HINT
The SET CURRENT OPTIMIZATION HINT statement assigns a value to the CURRENT OPTIMIZATION HINT special register.
Invocation
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.
Authorization
None required.
Syntax
>>-SET CURRENT OPTIMIZATION HINT--=--+-string-constant-+------->< '-host-variable---'
Description
The value of special register CURRENT OPTIMIZATION HINT is replaced by the value of the string constant or host variable. The value must be a character string that is not longer than 128 bytes.
Notes
Using the OPTIMIZATION HINT special register: The CURRENT OPTIMIZATION HINT special register specifies whether optimization hints are used in determining the access path of dynamic statements. An empty string or all blanks indicates that DB2® uses normal optimization techniques and ignores optimization hints.
Example
SET CURRENT OPTIMIZATION HINT = 'NOHYB';
If
you set the register this way, DB2 validates
and considers information in the rows in owner.PLAN_TABLE where the
value in the OPTHINT column matches 'NOHYB' for dynamic SQL statements. SET CURRENT OPTIMIZATION HINT = '';