clickhouse commands
17 commands, each with a one-line explanation. Click a command to copy it, or its title for details.
Commands 17 shown
-
clickhouse-client -h clickhouse -u default --password <pass> --database mydbOpen interactive ClickHouse CLI session
-
clickhouse-client -q 'SHOW DATABASES'List all databases in ClickHouse
-
clickhouse-client -q 'SHOW TABLES FROM mydb'List all tables in a database
-
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"Show disk usage per table in a database
-
clickhouse-client -q 'SELECT query_id, user, elapsed, query FROM system.processes ORDER BY elapsed DESC'List all currently running queries with elapsed time
-
clickhouse-client -q "KILL QUERY WHERE query_id='<id>'"Terminate a long-running or stuck query
-
clickhouse-client -q 'SYSTEM DROP MARK CACHE; SYSTEM DROP UNCOMPRESSED CACHE'Flush ClickHouse caches to free memory
-
clickhouse-client -q 'SYSTEM SYNC REPLICA mydb.myTable'Force replica to sync with ZooKeeper state
-
clickhouse-client --host ch.example.com --user default --password secret -q 'SELECT version()'Execute a one-shot query via clickhouse-client
-
clickhouse-client -q 'SELECT query_id, elapsed, query FROM system.processes ORDER BY elapsed DESC LIMIT 10'List longest running queries in the system
-
clickhouse-client -q "KILL QUERY WHERE query_id = 'abc-123'"Force-stop a specific query by its query_id
-
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'Top 20 tables by on-disk size
-
clickhouse-client -q 'OPTIMIZE TABLE mydb.mytable FINAL'Force merging of all parts (use with caution on 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 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
no commands match — try a different search