ClickHouse中system日志清理
背景
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;