How to check MySQL slow queries in real-time

Open up your console and type in the following

watch -n 1 ‘mysqladmin -uroot -pyourbeautifulpassword “processlist”‘

This will display the queries that are currently under execution and will be refreshed every 1 second.
Get a screenshot when you find queries that you suspect to slow down your server performance.
Optimize indexing based on the slow-queries. You will be able to make a difference with no doubt!

Opening up an additional console and using “tload” is also a good way to monitor your server load.

tload -d5 -s20

This will draw you a bar-graph that will be updated every 5 seconds. Very similar to “uptime” but with more visualization.

monitoring server load with tload
server load has dramatically decreased by just a few MySQL index tweaks

This is what I got after tweaking a few indexes based on to the slow-queries.

CC BY-NC-SA 4.0 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Leave a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.