tags:

views:

297

answers:

4

Because ther eis a lot in there..and "time" is big number.

A: 

from directly in the mysql interface? you can't. you'll have to write a script in another language or a stored procedure.

longneck
+2  A: 

You need to kill them one by one, MySQL does not have any massive kill command. You can script it in any language, for example in PHP you can use something like:

$result = mysql_query("SHOW FULL PROCESSLIST");
while ($row=mysql_fetch_array($result)) {
  $process_id=$row["Id"];
  if ($row["Time"] > 200 ) {
    $sql="KILL $process_id";
    mysql_query($sql);
  }
}
Michal Čihař
A: 

Be careful you don't kill an optimize table query as you will hose that table.

philjohn
What is an optimize table query?
TIMEX
It's a query you run to perform some cleanup on a table, for instance fixing any split/deleted rows, sorting index pages, update statistics, compact the file after large deletes (especially where you have variable length columns such as VARCHAR).The long and short of it though, is do not kill any query that starts with OPTIMIZE TABLE unless you have a very recent backup!More details here: http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html
philjohn
A: 

Check out the first comment on the mysql ref guide for the kill command. It provides a useful script.

Matt