OPTCOMPIND configuration parameter
Use the OPTCOMPIND to specify information that helps the optimizer choose an appropriate query plan for your application.
- onconfig.std value
- OPTCOMPIND 2
- values
0
= When appropriate indexes exist for each ordered pair of tables, the optimizer chooses index scans (nested-loop joins), without consideration of the cost, over table scans (hash joins). This value ensures compatibility with previous versions of the database server.1
= The optimizer uses costs to determine an execution path if the isolation level is not Repeatable Read. Otherwise, the optimizer chooses index scans (it behaves as it does for the value0
). This setting is recommended for optimal performance.2
= The optimizer uses cost to determine an execution path for any isolation level. Index scans are not given preference over table scans; the optimizer bases its decision purely on cost. This value is the default if the variable is not set.- takes effect
- After you edit your onconfig file and restart the database server.
Usage
Because of the nature of hash joins, an application with isolation mode set to Repeatable Read might temporarily lock all records in tables that are involved in the join (even those records that fail to qualify the join) for each ordered set of tables. This situation leads to higher contention among connections. Conversely, nested-loop joins lock fewer records but provide inferior performance when the database server retrieves a large number of rows. Thus, both join methods offer advantages and disadvantages. A client application can also influence the optimizer in its choice of a join method.