Note
Adaptive major compaction is available in OceanBase Database V4.x. Adaptive major compaction is controlled by the
_enable_adaptive_compactionparameter. When adaptive major compaction is enabled, the system collects and statistics user queries and writes in real time, and schedules major compaction tasks for partitions as needed. One of the scenarios for triggering adaptive major compaction is when a partition is frequently compacted and reaches the threshold. For more information about adaptive major compaction, see Adaptive major compaction.The
major_compact_triggerparameter specifies the number of major compactions (the prerequisite of major compaction) that triggers a tenant-level major compaction. Themajor_compact_triggerparameter is a tenant-level parameter. Compared with adaptive major compaction, tenant-level major compaction has a larger granularity and involves more partitions, and consumes more system resources. Therefore, we recommend that you do not use themajor_compact_triggerparameter when adaptive major compaction is enabled.- The scope of the
major_compact_triggerparameter was changed from the cluster level to the tenant level starting from V4.0.0.
Description
major_compact_trigger specifies the number of major compactions (the prerequisite of major compaction) that triggers a major compaction.
Privilege requirements
Query the parameter
The
systenant and all user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query this parameter.Modify the parameter
The
systenant and user tenants can modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Type | Int |
| Default value | 0. This value indicates that a major compaction is not triggered regardless of the number of major compactions.
NoteThe default value of this parameter was changed from 5 to 0 starting from V4.0.0. |
| Value range | [0, 65535] |
| 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. |
Examples
Set the parameter to 10. A tenant-level major compaction is triggered after 10 major compactions.
obclient> ALTER SYSTEM SET major_compact_trigger=10;