目录

MySQL服务器CPU占用过高

CPU占用过高的可能性

1、排查占用CPU的进程

2、找到占用CPU高的线程

3、查找mysql中对应的线程ID

mysql> select thread_id,name ,PROCESSLIST_ID,THREAD_OS_ID from performance_schema.threads where THREAD_OS_ID = 3694;
+-----------+---------------------------------------------+----------------+--------------+
| thread_id | name                                        | PROCESSLIST_ID | THREAD_OS_ID |
+-----------+---------------------------------------------+----------------+--------------+
|        84 | thread/sql/one_connection                   |           15   |         3694 |
+-----------+---------------------------------------------+----------------+--------------+
1 rows in set (0.00 sec)

4、获取对应的sql

mysql> select sql_text from performance_schema.events_statements_current where thread_id = 84;
+----------+
| sql_text |
+----------+
| ......   |
+----------+
1 row in set (0.00 sec)

友情链接