mysqlterminalprocesslist

MySQL: help finding query which take too long to execute


How to find the MySQL query which take too long to execute (more than 5 sec)?

I tried using PROCESSLIST but its showing minimum info. I need the full query currently running in the server so i can try optimizing the queries to decrease my server load.

Is there any terminal command available to find the currently processing query?


Solution

  • If you are using MySQL 5.1+, the slow query log can be used. Here and here is documentation. The configuration and running options are related to MySQL version. But I believe you can achieve your goals following the instructions related to your environment.