Through the status command, view slow queries this item, if the value is long >0, the query execution time is too long
Copy Code code as follows:
The following are the referenced contents:
mysql> status;
--------------
MySQL Ver 11.18 distrib 3.23.58, for Redhat-linux-gnu (i386)
Connection id:53
Current database: (NULL)
Current User:root@localhost
Current Pager:stdout
Using outfile: '
Server Version:5.0.37-log
Protocol version:10
Connection:localhost via UNIX socket
Client characterset:latin1
Server characterset:latin1
UNIX Socket:/tmp/mysql.sock
Uptime:4 hours sec
Threads:1 questions:706 Slow queries:0 opens:177 Flush Open tables:
Queries per second avg:0.002
--------------
At this point, the show Processlist command is used to view the currently running SQL, find out which SQL statements are running slowly, find the execution of the slow statements, and then use the explain command to view the execution plans for those statements.
Mysql> show Processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+-------+------------------+
| 53 | Root | localhost | NULL | Query | 0 | NULL | Show Processlist |
+----+------+-----------+------+---------+------+-------+------------------+