Created on 01-27-2017 08:06 AM - edited 09-16-2022 03:58 AM
How to kill or cancel a query if it is running longer than normal automatically, i killed queries that are running longer from cloudera manager. but want something automated way.
Please provide details if there is a possibility.
Thank you very much for the helpful info.
As far I am concerned I dont think there is no way to dectect them kill automatically .
One way to slove the long runining query is to inspect your query flow , streaming also enable
strict mode - In this mode some risky query will not be performed like cartesian product , ordering without limit clause.
There is no direct way of enforcing a strict mode to Impala
However you can cotrol the run time behaviour of the queries by issuing SET statement
for example controling the memory limit , max_scan_range_lenth
Please refer this link
I use the below trick in shell scripts for known queries that don't have an impact if killed.
I call the impala-shell from bash/cron using the below line
timeout 600 impala-shell -i $IMPALA_ADDRESS -q "compute stats hive_db.table_name;"
The all important part is "timeout 600" which will end the session after 10 mins.