Updated on 2026-06-27 GMT+08:00

Doris Supports Table-Level Compaction Tuning

Scenario

  • If the service involves real-time and offline data import to the database, and the offline data import task contains core service tables, such as wide tables with aggregation keys, which are required to have high query performance, you can set an independent Cumulative Compaction interval policy for these tables. By shortening the Compaction interval, you can accelerate file compaction and improve the query efficiency.
  • In scenarios where the service has low requirements on the query performance of some non-core tables, to ensure that the query performance of other core tables is not affected, you can set a Cumulative Compaction interval policy for these non-core tables. By increasing the Compaction interval of the tables, more core tables can be compacted to meet the query performance requirements of core table services.

Notes and Constraints

  • This section applies only to MRS 3.6.0-LTS and later.
  • Ensure that the memory, CPU, and disk I/O throughput usage of the BE cluster remains below 60%. If the usage is too high, you are advised to use this feature after cluster scale-out.
  • This feature works together with Compaction tuning parameters on BE. For details about common Compaction tuning parameters on BE, see Table 1.
    Table 1 Compaction tuning parameters on BE

    Parameter

    Tunned Value

    Default Value

    Parameter Description

    max_cumu_compaction_threads

    8

    -1

    The maximum number of Cumulative Compaction threads. Increasing the value can speed up the compaction. The value is calculated based on the number of disks by default.

    enable_delete_when_cumu_compaction

    true

    false

    Whether to perform cumulative compaction for the logically deleted files

    base_compaction_min_rowset_num

    15

    5

    The minimum number of rowsets for triggering base compaction. Increasing the value can avoid frequent base compaction. You are advised to set this parameter only in extreme scenarios where data is frequently imported to the database.

    compaction_task_num_per_disk

    8

    4

    The maximum number of compaction tasks that can run concurrently on each disk

    cumulative_compaction_min_deltas

    1

    5

    The threshold of file count for triggering Cumulative Compaction. You are advised to set this parameter only in extreme compaction scenarios where files are frequently imported to the database.

Example

  • Set the cumulative_compaction_pause_interval_seconds parameter in the table properties of the Doris table creation statement. This parameter specifies the interval of the cumulative compaction of the table, in seconds. If this parameter is not set, the default interval is 120 seconds. For example, you can run the following command to set the parameter:
    create table z_test (
    id int,
    name varchar(40),
    max_dm int MAX
    ) aggregate key(id, name)
    distributed by hash(id, name) buckets 4
    PROPERTIES (
    "cumulative_compaction_pause_interval_seconds"="20"
    );
  • Run the ALTER TABLE command to change the parameter value of the table.
    ALTER TABLE z_test SET ("cumulative_compaction_pause_interval_seconds"="600");