major_compact_trigger

2025-12-02 02:50:56  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 collect and statistics on user queries and writes in real time and schedule partition merge tasks as needed. A partition merge task is scheduled for a partition when adaptive major compaction is triggered due to frequent minor compactions in the partition, which reaches the specified threshold. For more information about adaptive major compaction, see Adaptive major compaction.

    The major_compact_trigger parameter specifies that a tenant merge task is scheduled when the number of freezes in a tenant reaches the specified threshold. The control scope of the major_compact_trigger parameter is the tenant. Compared with adaptive major compaction, tenant-level major compaction operates on a coarser granularity and involves more partitions, thus consuming more system resources. Therefore, we recommend that you do not set the major_compact_trigger parameter when adaptive major compaction is enabled.

  • The parameter scope is changed from cluster-level to tenant-level in V4.0.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 this parameter.

  • Modify the parameter

    Users in the sys tenant and user tenants can modify this parameter.

Attributes

Attribute Description
Parameter type Int
Default value 0, which specifies that a major compaction is not automatically 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. It can be modified by using the ALTER SYSTEM SET statement.
Takes effect after OBServer node restart No

Example

A major compaction is triggered after 10 freezes.

obclient> ALTER SYSTEM SET major_compact_trigger=10;

Contact Us