Slowest recent queries clickhouse
Top slow finished queries last hour with memory; type=2 = QueryFinish
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"
more clickhouse
all 17 commands →
Pending mutations
clickhouse-client -q "SELECT database, table, mutation_id, latest_fail_reason FROM system.mutations WHERE is_done=0"
Connect to clickhouse-client
clickhouse-client -h clickhouse -u default --password <pass> --database mydb
Show databases
clickhouse-client -q 'SHOW DATABASES'
Show tables
clickhouse-client -q 'SHOW TABLES FROM mydb'
Table size
clickhouse-client -q "SELECT table, formatReadableSize(sum(bytes)) AS size FROM system.parts WHERE active AND database='mydb' GROUP BY table ORDER BY sum(bytes) DESC"