Running queries

List all currently running queries with elapsed time

clickhouse-client -q 'SELECT query_id, user, elapsed, query FROM system.processes ORDER BY elapsed DESC'

tool
clickhouse17 commands
tags
clickhousemonitoringdebug

More clickhouse commands

  • 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

all 17 clickhouse commands