Note
OceanBase Database V4.x has adaptive major compaction enabled by default, which is controlled by the
_enable_adaptive_compactionswitch. When adaptive major compaction is enabled, the system collects and statistics user queries and writes in real time, and schedules partition compaction tasks as needed. One scenario where adaptive major compaction is triggered is when a partition experiences frequent minor compactions, which triggers a major compaction for that partition. For more information about adaptive major compaction, see Adaptive major compaction.The
major_compact_triggerparameter specifies the number of freeze (a prerequisite for minor compaction) operations before a major compaction is triggered for a tenant. Themajor_compact_triggerparameter is tenant-level, whereas adaptive major compaction is partition-level. Adaptive major compaction schedules fewer but larger partition compaction tasks, which consumes fewer system resources. Therefore, we recommend that you do not use themajor_compact_triggerparameter when adaptive major compaction is enabled.- This parameter is effective for tenants from V4.0.0.
Description
The major_compact_trigger parameter specifies the number of freeze (a prerequisite for minor compaction) operations before a major compaction is triggered for a tenant.
Privilege requirements
Query the parameter
The
systenant and all user tenants can execute theSHOW PARAMETERSstatement or query theGV$OB_PARAMETERSview to obtain the value of this parameter.Modify the parameter
The
systenant and user tenants can modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Type | Int |
| Default value | 0, indicating that a major compaction will not be automatically triggered regardless of the number of minor compactions.
NoteThe default value of this parameter is changed from 5 to 0 in V4.0.0. |
| Value range | [0, 65535] |
| Modifiable | Yes, you can execute the ALTER SYSTEM SET statement to modify this parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Example
Set the value of this parameter to 10 to trigger a major compaction after 10 minor compactions.
obclient> ALTER SYSTEM SET major_compact_trigger=10;