Long query on mysql often fill up your server’s CPU and RAM with a bunch of load. It can be happened because un-optimized query, dirty table, very large row, etc.
You can enable slow query log on your mysql server :
Edit your my.cnf config, under [mysqld] add :
log-slow-queries = /var/log/mysql-slow.log
long_query_time = 3
- Create /var/log/mysql-slow.log and chmod it :
chown mysql.root /var/log/mysql-slow.log
Restart MySQL Services : service mysql restart
This will make MySQL to log queries that take more than 3 seconds to execute.