aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--personal_infra/clickhouse_maintenance.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/personal_infra/clickhouse_maintenance.md b/personal_infra/clickhouse_maintenance.md
new file mode 100644
index 00000000..e8d3e71f
--- /dev/null
+++ b/personal_infra/clickhouse_maintenance.md
@@ -0,0 +1,15 @@
+```
+$ ssh clickhouse...
+$ clickhouse-client
+$ use system;
+$ SELECT
+ table,
+ formatReadableSize(sum(bytes)) AS size,
+ min(min_date) AS min_date,
+ max(max_date) AS max_date
+FROM system.parts
+WHERE active
+GROUP BY table
+ORDER BY sum(bytes) ASC
+$ truncate table ...
+```