Note
For V3.2.3 BP10, this parameter is available starting with V3.2.3 BP10.
Description
optimizer_index_cost_adj specifies the proportion of the statistics cost in the cost of an index scan.
Privilege requirements
Query the parameter
sysand MySQL user tenants can query this parameter by using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify the parameter
sysand MySQL user tenants can modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Type | Int |
| Default value | 0 |
| Value range | [0, 100]
NoteWe recommend that you set the value to 10. If you want to set the value to another value, contact Technical Support. |
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
We recommend that you use this parameter in scenarios where data skew exists in business indexes:
- When the value is 0, the optimizer calculates the cost of an index scan based on the estimated number of rows in the storage layer.
- When the value is 10, the optimizer calculates the cost of an index scan based on 10% of the statistics cost and 90% of the storage layer cost.
- When the value is 100, the optimizer calculates the cost of an index scan based on the statistics cost.
Examples
In a
systenantDisable the index selection optimization feature for all tenants:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=0 tenant=all_user;Enable the index selection optimization feature:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=10 tenant=all_user;
In a MySQL user tenant
Disable the index selection optimization feature for the current tenant:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=0;Enable the index selection optimization feature:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=10;
In an Oracle user tenant
Disable the index selection optimization feature:
obclient> ALTER SYSTEM SET "optimizer_index_cost_adj"=0;Enable the index selection optimization feature:
obclient> ALTER SYSTEM SET "optimizer_index_cost_adj"=10;