Note
This parameter was introduced in OceanBase Database V3.2.3 BP10.
Description
optimizer_index_cost_adj specifies the proportion of statistics cost in the index scanning cost calculated by the optimizer.
Privilege requirements
Query the parameter
sysand MySQL user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query this parameter.Modify the parameter
sysand MySQL user tenants can modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Type | Integer |
| Default value | 0 |
| Value range | [0, 100]
NoteWe recommend that you set the value to |
| 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 business indexes have data skew.
- The value
0indicates that the optimizer uses only the row estimation information at the storage layer to calculate the index scanning cost. - The value
10indicates that the optimizer calculates the index scanning cost by adding 10% of the statistics cost and 90% of the storage layer information cost. - The value
100indicates that the optimizer uses only statistics to calculate the index scanning cost.
Examples
systenantDisable index selection optimization for all tenants:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=0 tenant=all_user;Enable index selection optimization:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=10 tenant=all_user;
MySQL tenant
Disable index selection optimization for the current tenant:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=0;Enable index selection optimization:
obclient> ALTER SYSTEM SET optimizer_index_cost_adj=10;
Oracle tenant
Disable index selection optimization for the current tenant:
obclient> ALTER SYSTEM SET "optimizer_index_cost_adj"=0;Enable index selection optimization:
obclient> ALTER SYSTEM SET "optimizer_index_cost_adj"=10;