OPTIMIZE

2025-11-14 07:33:32  Updated

Purpose

You can use this statement to enable a progressive compaction.

The number of rounds of the progressive compaction is specified by the progressive_merge_num parameter of the table. If the progressive_merge_num parameter is not specified for the table, the default value of the tenant is used.

  • In the sys tenant, you can initiate major compactions for business tenants.

  • In a business tenant, you can initiate major compactions for tables of the tenant.

Syntax

OPTIMIZE {
     TABLE table_list
   | TENANT {ALL | tenant_list}
};

table_list:
   table_name [,table_name ...]

tenant_list:
    tenant_name [,tenant_name ...]

Parameters

Parameter Description
table_name The name of the table on which the progressive compaction is to be performed.
tenant_name The name of the tenant on which the progressive compaction is to be performed. ALL indicates all tenants.

Examples

Initiate a progressive compaction for table t1.

obclient> OPTIMIZE TABLE t1;
Query OK, 0 rows affected

Contact Us