PHP Draino
Posted: 2009-04-15 00:00:00

...for all your sql unclogging needs. On a live site for a client at work, their site was jamming and no orders could be placed. I was able to track it down - locked tables.

The tables were locked for what is still an unknown reason, but it seemed to be related to a particular user account. Once I figured out that the tables were sticking as locked, I wrote a little script that cleans out the locks on mysql - pretty simple really, just show the processes accessing the tables and locking them, then go through and kill each one. Probably not the most elegant solution, but, hey, it got the site back up and running. We recommended that they reboot the mysql server as well and the site remains live. I'll post the snippet up to the Code area in the Projects section -- it won't be complete (as I'm using a custom database class), but it shows the queries to run.

Back to the main page