数据库本身的日志占多数,早期的日志未处理,后面的都设置了30天自动清理的。
操作涉及的一些SQL如下:
SELECT sum(rows) AS total_rows, formatReadableSize(sum(data_uncompressed_bytes)) AS before_compress, formatReadableSize(sum(data_compressed_bytes)) AS after_compress, round((sum(data_compressed_bytes)/sum(data_uncompressed_bytes))* 100,0) AS compress_rate, table AS tbname FROM system.parts where database = 'system' group by table SELECT * FROM system.parts where database = 'system' and table= 'query_log_0' select count(*) from system.query_log_0; ALTER table `system`.query_log_0 DELETE where event_date is not null; ALTER table `system`.trace_log_0 DELETE where event_date is not null;
------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------
转载请注明本文标题和链接:《ClickHouse清理磁盘空间》
发表评论