Show table disk usage
Show the top 20 tables by size on disk
clickhouse-client -q 'SELECT database, table, formatReadableSize(sum(bytes_on_disk)) AS size FROM system.parts GROUP BY database, table ORDER BY sum(bytes_on_disk) DESC LIMIT 20'
- tool
- clickhouse17 commands
- tags
- clickhousemonitoring
More clickhouse commands
-
clickhouse-client -q 'OPTIMIZE TABLE mydb.mytable FINAL'Force a merge of all parts, be careful with large tables
-
clickhouse-client --query 'INSERT INTO mydb.events FORMAT CSVWithNames' < events.csvBulk-load a CSV file into a ClickHouse table
-
clickhouse-client -q 'SELECT database, table, is_leader, queue_size, absolute_delay FROM system.replicas WHERE absolute_delay > 0'Show replication lag for replicas that are behind
-
clickhouse-client -q "SELECT query_duration_ms, formatReadableSize(memory_usage) mem, substring(query,1,80) FROM system.query_log WHERE type=2 AND event_time>now()-3600 ORDER BY query_duration_ms DESC LIMIT 10"Top 10 slowest finished queries in the last hour with memory usage; type=2 means QueryFinish
-
clickhouse-client -q "SELECT database, table, mutation_id, latest_fail_reason FROM system.mutations WHERE is_done=0"Find stuck ALTER/DELETE mutations and why they fail, they block schema changes