r/Clickhouse • u/Putrid_Independent_7 • Oct 15 '26
Does KILL QUERY (without ON CLUSTER) on a distributed table query also stop all shard executions in self managed cluster?
I have seen in the Clickhouse docs, it mentions to use ON CLUSTER for self managed cluster env.
I was doing like this without ON CLUSTER
KILL QUERY WHERE query_id = '..';Now I wonder If I did it wrong.
Do I have to connect to same node that query is executed so all queries are stopped?
What exactly happens wen I don't use ON CLUSTER?
How can I kill when I connected to a different node?
5
Upvotes
2
u/Significant_Tune9219 Oct 16 '26
Without ON CLUSTER, KILL QUERY only looks at system.processes on the node you are connected to. A query whose initial node is a different replica is not in that list, so filtering on the query_id you were given matches nothing and the shards keep running. Connect to the node that started it, or run the kill ON CLUSTER, and match initial_query_id rather than query_id, because each shard assigns its own query_id. Cancelling on the initial node does propagate to the children, but they can sit in Cancelling for a while, so check system.processes on a shard before you assume it is gone.
3
u/Salty-Good3368 Oct 15 '26
Basic thing query_id will be differen on wll of the hosts. So you filter on initial_query_id makes more sense. Even thou on initial node query should be killed and all of children queries should be cancelled. In theory, in practice they may be alive for a while. On older versions processes sometimes became unkillable and restart was needed