Help Center> MapReduce Service> FAQs> Big Data Service Development> How Do I Add a Periodic Deletion Policy to Prevent Large ClickHouse System Table Logs?
Updated on 2023-06-27 GMT+08:00

How Do I Add a Periodic Deletion Policy to Prevent Large ClickHouse System Table Logs?

Symptom

ClickHouse logs generated in the system table is too large. Deleting logs at a time takes a long time.

Handling Procedure

To delete the logs periodically, add a deletion policy. On the ClickHouse client, run the following statement to set the TTL for the system table:

alter table system.Table name modify TTL event_date + INTERVAL Number of days for storing data day;

This statement is used only on a SQL node to configure the TTL of the system table. If the TTL needs to be configured on all nodes, run this statement on each node. Do not run the statement with on cluster on each node. Otherwise the ClickHouse will keep running.

Run the preceding statement during off-peak hours. This operation may take a long time if there is a large amount of data.

Big Data Service Development FAQs

more