We are managing an Azure Database for MySQL and we received an alert that CPU usage has spiked to 90% and stayed high for the last 30 minutes. The application team says the database performance has become very slow. How would we go about identifying the r

Saisantosh Sadnnah 20 Reputation points
2025-05-08T11:48:44.9166667+00:00

We are managing an Azure Database for MySQL and we received an alert that CPU usage has spiked to 90% and stayed high for the last 30 minutes. The application team says the database performance has become very slow. How would we go about identifying the root cause and resolving this issue? Please walk me through your approach?

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
996 questions
{count} votes

Accepted answer
  1. Sai Raghunadh M 4,640 Reputation points Microsoft External Staff Moderator
    2025-05-09T11:38:17.2866667+00:00

    Hi @ Saisantosh Sadnnah

    To check which queries are running for too long in MySQL, you can use the SHOW PROCESSLIST; command. This command displays a list of currently running threads, including their execution time, state, and query details. If you want to see the full query text, use SHOW FULL PROCESSLIST; instead.

    Additionally, you can query the INFORMATION_SCHEMA.PROCESSLIST table to get more detailed insights into running queries:

    SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE TIME > 30;
    

    This will show queries that have been running for more than 30 seconds, helping you identify potential bottlenecks.

    Please go through these similar threads that might help you:

    https://stackoverflow.com/questions/16571416/how-can-i-get-a-full-list-of-all-queries-currently-running-on-my-mysql-server?__cf_chl_tk=CTgxgvNg.716trB2a7GHtVwWaYdmGN4mnZTA4pbPr7o-1746790617-1.0.1.1-CnzuMDJYFzTAhHQYTrhkNh.WofVk4WYj1NBQW16T1vk

    https://stackoverflow.com/questions/3638689/how-to-see-full-query-from-show-processlist

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.