Note
OceanBase Database V4.x has adaptive major compaction enabled by default (controlled by the
_enable_adaptive_compactionswitch). When adaptive major compaction is enabled, the system will real-time collect and statistics on your queries and writes, and schedule partition merge tasks as needed. A scenario where adaptive major compaction is triggered is as follows: If a partition experiences frequent minor compactions and reaches the specified threshold, a partition merge task is scheduled for the partition.The
major_compact_triggerparameter specifies that a tenant-level major compaction is scheduled when the number of freezes in a tenant reaches the specified threshold. Note that themajor_compact_triggerparameter applies at the tenant level, whereas adaptive major compaction applies at the partition level. Therefore, themajor_compact_triggerparameter provides a higher granularity and involves more partitions, resulting in higher system resource consumption. If adaptive major compaction is enabled, we recommend that you do not set themajor_compact_triggerparameter.- The scope of the
major_compact_triggerparameter is adjusted from cluster-level in V3.x to tenant-level in V4.0.
Description
The major_compact_trigger parameter specifies the number of freezes that trigger a major compaction.
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 all user tenants can modify the parameter.
Attribute description
| Attribute | Description |
|---|---|
| Parameter type | Int |
| Default value | 0, which specifies that no automatic major compaction is triggered regardless of the number of freezes.
NoteThe default value is changed from 5 to 0 in V4.0.0. |
| Value range | [0, 65535] |
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify it. |
| Takes effect after OBServer node restart | No |
Example
Specify to schedule a global major compaction after 10 freezes.
obclient> ALTER SYSTEM SET major_compact_trigger=10;