Linux – Best way to debug MySQL slow queries

linuxMySQL

First of all I like to inform you that I am a new User on Linux administration and I need some help.

I own a CloudLinux web server, and I am faced with a MySQL Slow Queries problem. The problem is that I have several users on my host, that run lot's of slow queries, and this has as a result the MySQL Service termination (I suppose that is termination. In reality, the MySQL server does not respond at all).

The question now is, how can I debug this queries ? I know about the slow queries log file. Already I have see the file, but the content is too hard to get read it. So is there any better way used by Pro ?

Kind regards

Best Answer

Use the Percona query digest tool to build summaries of the slow query log. This will help you find the slowest of the slow:

http://www.percona.com/doc/percona-toolkit/2.2/pt-query-digest.html

Then use mysql's EXPLAIN command to figure out WHY a particular query is slow:

http://dev.mysql.com/doc/refman/5.0/en/explain.html

Hope this helps

Related Topic