mysql_sql查性能语句

时间:2019-11-06
本文章向大家介绍mysql_sql查性能语句,主要包括mysql_sql查性能语句使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
mysql> SHOW PROCESSLIST;
+----+--------+----------------------+-------+-------------+--------+-----------------------------------------------------------------------+------------------+
| Id | User   | Host                 | db    | Command     | Time   | State                                                                 | Info             |
+----+--------+----------------------+-------+-------------+--------+-----------------------------------------------------------------------+------------------+
|  3 | copy_u | 192.168.31.128:49106 | NULL  | Binlog Dump | 292296 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL             |
|  7 | copy_u | 192.168.31.42:60886  | NULL  | Binlog Dump |   1688 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL             |
|  8 | root   | localhost            | DATA1 | Query       |      0 | init                                                                  | SHOW PROCESSLIST |
+----+--------+----------------------+-------+-------------+--------+-----------------------------------------------------------------------+------------------+
3 rows in set (0.00 sec)
查看系统上运行的所有线程
mysql> SHOW GLOBAL STATUS;
+-----------------------------------------------+-------------+
| Variable_name                                 | Value       |
+-----------------------------------------------+-------------+
| Aborted_clients                               | 2           |
| Aborted_connects                              | 0           |
| Binlog_cache_disk_use                         | 0           |
| Binlog_cache_use                              | 5           |
| Binlog_stmt_cache_disk_use                    | 0           |
| Binlog_stmt_cache_use                         | 4           |
| Bytes_received                                | 8341        |
| Bytes_sent                                    | 57632       |
。。。。。
显示全局变量的所有值

mysql> SHOW SESSION STATUS;
+-----------------------------------------------+-------------+
| Variable_name                                 | Value       |
+-----------------------------------------------+-------------+
| Aborted_clients                               | 2           |
| Aborted_connects                              | 0           |
| Binlog_cache_disk_use                         | 0           |
| Binlog_cache_use                              | 5           |
| Binlog_stmt_cache_disk_use                    | 0           |
| Binlog_stmt_cache_use                         | 4           |
| Bytes_received                                | 601         |
.......
显示会话变量的统计信息

原文地址:https://www.cnblogs.com/betterquan/p/11806083.html