0

I have an expensive reporting query that can take 1-20+ seconds to run. (Depending on how much data it has)

Is there a way to kill a mysql process/query from running after a certain amount of time?

I see this:

mysql auto kill query

Is this the best route? I have also read that I should try to improve my queries. I will look into this too, but I am just asking for suggestions on the best route.

Community
  • 1
  • 1
Chris Muench
  • 17,444
  • 70
  • 209
  • 362
  • possible duplicate of [Setup MySQL query timeout](http://stackoverflow.com/questions/2137084/setup-mysql-query-timeout) – tadman Feb 28 '14 at 21:28

1 Answers1

0

First run

show processlist;

then find the query that you want to kill then run

kill "1";

1 is the id of the query you want to kill you have to choose it according to the list

Sam
  • 2,761
  • 3
  • 19
  • 30
  • I understand how to kill queries, I just want to have an automated process that kills queries that are running long to free up memory. – Chris Muench Feb 28 '14 at 21:22
  • look here then http://serverfault.com/questions/401828/how-to-automatically-kill-slow-mysql-queries-after-n-seconds – Sam Feb 28 '14 at 21:23