Stop mysql query if it is too long
4 answers
As far as I know, you cannot stop the request after it has completed.
I understand that I need to optimize queries instead.
The way you should go.
Another possibility:
You can look at SQL Transactions if applicable.
+1
source to share
There is no way in mysql to limit the duration of the query execution and then the timeout. Have a "long request killer" script that catches kills and reports bad requests, for example. looking at the SHOW FULL PROCESSLIST property. You can do this with a stored procedure and call it at a scheduled time or through an application that also connects to mysql on a schedule as well.
0
source to share