Connect and run a query
Execute a one-shot query via clickhouse-client
clickhouse-client --host ch.example.com --user default --password secret -q 'SELECT version()'
- tool
- clickhouse17 commands
- tags
- clickhouse
More clickhouse commands
-
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