Manually initiate a major compaction

2023-12-08 07:13:36  Updated

You can manually initiate a major compaction.

Prerequisites

Before a major compaction is triggered, make sure that global major compaction is enabled. Global major compaction is controlled by the cluster-level parameter enable_major_freeze. The default value is True, which specifies to enable global major compaction.

If global major compaction is disabled for the current cluster, perform the following steps to enable this feature:

  1. Log on to the sys tenant of the cluster as the root user.

  2. Verify that global major compaction is enabled.

    obclient> SHOW PARAMETERS LIKE 'enable_major_freeze';
    
  3. If global major compaction is not enabled, execute the following statement to enable the feature.

    obclient> ALTER SYSTEM SET enable_major_freeze='True';
    

    For more information about the enable_major_freeze parameter, see enable_major_freeze.

Manually initiate a major compaction from the sys tenant

You can initiate a major compaction for the current tenant, all tenants, or specified tenants from the sys tenant.

To do so, perform the following steps:

  1. Log on to the sys tenant of the cluster as the root user.

  2. Use the following syntax to initiate a major compaction:

    obclient> ALTER SYSTEM MAJOR FREEZE TENANT [=] ALL | tenant_name [, tenant_name ...];
    

    Here, [=] indicates that the equal sign (=) is optional.

    Here are some examples:

    • Initiate a major compaction for the current tenant from the sys tenant

      obclient> ALTER SYSTEM MAJOR FREEZE TENANT;
      
    • Initiate a major compaction for all tenants

      obclient> ALTER SYSTEM MAJOR FREEZE TENANT = ALL;
      
    • Initiate a major compaction for a specified tenant

      obclient> ALTER SYSTEM MAJOR FREEZE TENANT = tenant1,tenant2;
      

Manually initiate a major compaction for a user tenant

A user tenant can initiate a major compaction only for itself.

  1. Log on to the database as an administrator of a user tenant.

  2. Initiate a major compaction for the current tenant.

    obclient> ALTER SYSTEM MAJOR FREEZE;
    

References

Contact Us