Overview
partition_index_dive_limit specifies the maximum number of partitions that the optimizer can use for row estimation at the storage layer.
Privilege requirements
Query variables
Both the
systenant and all user tenants can use theSHOW VARIABLESstatement or theinformation_schema.SESSION_VARIABLESview to view the values of session system variables.Modify variables
The
systenant and all user tenants can directly modify the values of session system variables for their own tenants.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Int |
| Default Value | 10 |
| Value range | [0, INT64_MAX]
Note
|
| Effective Scope | Session |
| Modifiable | Yes, you can use theSETStatement modification. |
Usage instructions
Modify this variable to control the partition count limit when the optimizer estimates rows for storage layer access:
When the number of partitions is less than this value, all partitions are always selected for row estimation in the storage layer.
When the number of partitions is greater than or equal to this variable, randomly select
partition_index_dive_limitpartitions for row estimation at the storage layer and scale the estimation results proportionally.When the variable is
0, all partitions are always selected for storage layer row estimation.When both
range_index_dive_limitandpartition_index_dive_limitare negative, the storage-layer estimation row strategy reverts to the old version's behavior. It performs storage-layer estimation only within the first 10 ranges of a single partition and does not sample beyond that.To disable row cardinality estimation at the storage layer, you can use the system variable
enable_storage_cardinality_estimation.
The differences from MySQL are as follows:
- MySQL controls the number of equal-range indexes only through the system variable
eq_range_index_dive_limitand does not limit the number of partitions. OceanBase AI Database uses this variable to limit the number of partitions for row estimation at the storage layer.
Configuration example
Set the partition count limit for storage layer row estimation in the current session to 1. This means only one partition is randomly selected for storage layer row estimation.
obclient [test]> SET partition_index_dive_limit = 1;
Query OK, 0 rows affected (0.002 sec)
For a complete example of observing the estimated row count through an execution plan, see partition_index_dive_limit.