ClickHouse中system日志清理

  |   0 评论   |   0 浏览

背景

ClickHouse运行一段时间后,发现system库占用空间40G!需要清理。

清理方法

删除对应的分区

ALTER table `system`.asynchronous_metric_log  DELETE where event_date is not null;
ALTER table `system`.metric_log DELETE where event_date is not null;
ALTER table `system`.part_log DELETE where event_date is not null;
ALTER table `system`.query_log DELETE where event_date is not null;
ALTER table `system`.query_thread_log DELETE where event_date is not null;
ALTER table `system`.session_log DELETE where event_date is not null;
ALTER table `system`.trace_log DELETE where event_date is not null;

参考

  1. ClickHouse默认库system日志清理方法(query_log、asynchronous_metric_log)
  2. Clickhouse清理大日志表