Some sql is not well written. Sometimes a search costs hours in applications.
When a application(maybe a website) submit a query which run long time, I have to restart the mysql.
How can I limit a sql query’s execution time in the database side?
Some sql is not well written. Sometimes a search costs hours in applications. When
Share
To auto kill a query in MySQL after a long execution time:
Create a stored procedure as:
then inside curosr’s loop do:
Create
EVENT FOR EVERY 5 SECONDSand justCALLthe above procedure inside it.Note: KILL QUERY just kills the query and MySQL connection is not broken. see here.