You can specify a point in time to trigger daily major compactions.
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.
Log on to the
systenant of the cluster as therootuser.Verify whether global major compaction is enabled.
obclient> SHOW PARAMETERS LIKE 'enable_major_freeze';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_freezeparameter, see enable_major_freeze.
Conditions for triggering a scheduled major compaction
When the system time on a day reaches the specified point in time, a major compaction is automatically triggered. You can set the major_freeze_duty_time parameter to specify the point in time that triggers daily major compactions or modify the point in time in the OceanBase Cloud Platform (OCP) console. By default, a major compaction is triggered at 02:00 on each day.
For more information about the major_freeze_duty_time parameter and other major compaction parameters, see Modify major compaction settings.
Use an SQL statement to specify the point in time at which daily major compactions are triggered
Log on to the
systenant of the cluster as therootuser.Execute the following statement to modify the point in time at which daily major compactions are triggered:
Modify the point in time at which daily major compactions are triggered for all tenants
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00';Modify the point in time at which daily major compactions are triggered for specified tenants
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT=tenant1, tenant2;