Note
OceanBase Database V4.x has the adaptive major compaction feature enabled by default (controlled by the
_enable_adaptive_compactionswitch). When this feature is enabled, the system will collect and statistics on user queries and writes in real time and schedule partition compactions as needed. A scenario that triggers an adaptive major compaction is as follows: If a partition experiences frequent minor compactions and the specified threshold is reached, a partition compaction task is scheduled for the partition. For more information about the adaptive major compaction feature, see Adaptive major compaction.The
major_compact_triggerparameter specifies that a tenant-level major compaction is scheduled when the number of times the tenant is frozen reaches the threshold. The control scope of themajor_compact_triggerparameter is the tenant. Compared with the adaptive major compaction feature, tenant-level major compaction has a coarser granularity, involves more partitions, and consumes more system resources. Therefore, we recommend that you do not set themajor_compact_triggerparameter when the adaptive major compaction feature is enabled.- Starting from V4.0.0, the scope of this parameter has been changed from cluster-level to tenant-level.
Description
The major_compact_trigger parameter specifies the number of freezes that must occur before a major compaction is triggered.
Privilege requirements
Query the parameter
Users in the
systenant and all user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query the parameter.Modify the parameter
Users in the
systenant and user tenants can modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Int |
| Default value | 0, which specifies that no automatic major compaction is triggered regardless of the number of freezes.
NoteStarting from V4.0.0, the default value has been changed from 5 to 0. |
| Value range | [0, 65535] |
| Modifiable | Yes. It can be modified by using the ALTER SYSTEM SET statement. |
| Takes effect after OBServer node restart | No |
Example
A major compaction is triggered when the tenant is frozen 10 times.
obclient> ALTER SYSTEM SET major_compact_trigger=10;