Optimize table (force merge)
Force merging of all parts (use with caution on large tables)
clickhouse-client -q 'OPTIMIZE TABLE mydb.mytable FINAL'
- tool
- clickhouse17 commands
- tags
- clickhouse
More clickhouse commands
-
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 on delayed replicas
-
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 slow finished queries last hour with memory; type=2 = QueryFinish
-
clickhouse-client -q "SELECT database, table, mutation_id, latest_fail_reason FROM system.mutations WHERE is_done=0"Find stuck ALTER/DELETE mutations with failure reason; blocks schema changes
-
clickhouse-client -h clickhouse -u default --password <pass> --database mydbOpen interactive ClickHouse CLI session