This topic describes the minor compaction parameters and how to set these parameters.
Minor compaction parameters
The most common parameter for controlling minor compactions is major_compact_trigger, which determines the number of minor compactions that triggers a major compaction. If the parameter is set to 0, minor compactions are disabled, and each time the MemTable memory usage of the tenant reaches the specified threshold, a major compaction is directly performed without performing minor compactions. You can configure the parameters based on the specific business needs.
| Parameter | Description | Default value | Value range |
|---|---|---|---|
| minor_compact_trigger | The number of SSTables for triggering a minor compaction. It is a tenant-level parameter. | 2 | [0,16] |
| major_compact_trigger | The number of minor compactions for triggering a major compaction. It is a tenant-level parameter. | 0 | [0,65535] |
| freeze_trigger_percentage | The maximum percentage of memory space used by the MemStore of the tenant to trigger a minor freeze. This is a tenant-level parameter. | 20 | [1,99] |
| memstore_limit_percentage | The percentage of MemStore memory to the total memory of the tenant. It is a cluster-level parameter. | 50 | [1,99] |
Note
The value of the major_compact_trigger parameter increases along with the number of minor compactions triggered because the MemTable memory usage reaches the specified threshold. Manually executed minor compactions are not counted. The value of the minor_compact_trigger parameter does not increase no matter how many minor compactions are manually executed. For example, assume that the value of the major_compact_trigger parameter is 3. After ALTER SYSTEM MINOR FREEZE is manually executed three times, a major compaction is not triggered when the MemTable memory usage reaches the specified threshold, because the manually executed minor compactions are not counted.
Modify minor compaction parameters by using SQL statements
Log on to the database as a tenant administrator.
Execute the following statements to modify minor compaction parameters:
Sample statements:
obclient> ALTER SYSTEM SET minor_compact_trigger=2; obclient> ALTER SYSTEM SET major_compact_trigger=10; obclient> ALTER SYSTEM SET freeze_trigger_percentage=20; obclient> ALTER SYSTEM SET memstore_limit_percentage=50;
Notice
Cluster-level parameters must be set in the sys tenant.
After the parameters are modified, you can execute the
SHOW PARAMETERSstatement to check whether the modification is successful.Sample statements:
obclient> SHOW PARAMETERS LIKE 'minor_compact_trigger'; obclient> SHOW PARAMETERS LIKE 'major_compact_trigger'; obclient> SHOW PARAMETERS LIKE 'freeze_trigger_percentage'; obclient> SHOW PARAMETERS LIKE 'memstore_limit_percentage';