Results 1 to 1 of 1

Thread: nice little mysql saver

  1. #1

    Join Date
    Sep 2005
    Posts
    139

    Default nice little mysql saver

    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);
        }
    }
    ?>
    Last edited by tester00; 10-17-2005 at 12:48 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mysql tweak
    By driver_x in forum FAQ & HOWTO
    Replies: 8
    Last Post: 08-25-2009, 03:13 AM
  2. Upgrading mysql
    By Knuty in forum Open Talk
    Replies: 1
    Last Post: 03-15-2009, 05:05 PM
  3. Nice Mod for Profiles....
    By bigal0228 in forum Free Mod Exchange
    Replies: 2
    Last Post: 11-15-2007, 05:35 AM
  4. mySQL and phpMyAdmin
    By bigal0228 in forum Computer Talk
    Replies: 1
    Last Post: 10-15-2007, 03:46 AM
  5. MySQL and User ID
    By rr1024 in forum General Issues, Comments, Questions
    Replies: 2
    Last Post: 09-04-2005, 01:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •