if your mysql tables are locked and slows down because of it...
my mysql tables are locked when I get high traffic...this little baby saves my business sometimes...I setup a cron for every 10 min to run this..
PHP Code:<?
mysql_connect("localhost", "dn_user", "db_pass") or die("Could not connect: " . mysql_error());
mysql_select_db("db_name") or die(mysql_error());
$result = mysql_query("SHOW FULL PROCESSLIST");
while ($row = mysql_fetch_array($result))
{
$process_id = $row["Id"];
//if ($row["Time"] > 200)
if ($row["State"] == "Locked" || $row["State"] == "Waiting for tables" || ($row["Command"] == "Sleep" && $row["Info"] == NULL))
{
$sql = "KILL $process_id";
mysql_query($sql);
}
}
?>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks