major_compact_trigger

2025-12-03 11:18:03  Updated

Note

  • OceanBase Database V4.x has adaptive major compaction enabled by default (controlled by the _enable_adaptive_compaction switch). 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_trigger parameter specifies that a tenant-level major compaction is scheduled when the number of freezes in a tenant reaches the specified threshold. Note that the major_compact_trigger parameter applies at the tenant level, whereas adaptive major compaction applies at the partition level. Therefore, the major_compact_trigger parameter 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 the major_compact_trigger parameter.

  • The scope of the major_compact_trigger parameter 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 sys tenant and all user tenants can use the SHOW PARAMETERS statement or the GV$OB_PARAMETERS view to query the parameter.

  • Modify the parameter

    Users in the sys tenant 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.

Note

The 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;

Contact Us