influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
28.6k stars 3.54k forks source link

Add ability to kill all running query at once #19391

Open vlyalcin opened 4 years ago

vlyalcin commented 4 years ago

Proposal: Killing all queries at once with a single command like "killall queries"

Current behavior: Current command kills only single qid: KILL QUERY qid

Desired behavior: Killing all queries at once with a single command like "killall queries"

Alternatives considered: Writing a small bash script that parses qids from "SHOW QUERIES" result. Then loop the qids and kill the query by qid.

Use case: I have historical data and in some cases, accidentally (especially during development), I query large date range that contains nested queries and calculations between columns. Such a big range of query causes high usage amount of CPU and RAM and that blocks the working of the other processes on the system.

Also, sometimes I have a very large input list for filter that comes from multiple selection sections of Grafana. So its not very easy to read qid from "SHOW QUERİES" result.

Thank you.

russorat commented 3 years ago

@vlyalcin thanks for the issue. Have you tried setting any of the query control configuration options? https://docs.influxdata.com/influxdb/v1.8/administration/config/#query-management-settings

russorat commented 3 years ago

You could probably do something like this as well, but i haven't tried it:

for i in $(/usr/local/bin/influx -execute "show queries" -format 'json' | jq '.results[].series[].values[0][0]'); do
    /usr/local/bin/influx -execute "KILL QUERY $i"
done