查看高频SQL
代码语言:javascript
复制mysql> show @@sql.high ;
------ ------ ----------- ---------- ---------- ---------- -------------- --------------- -------------------------------
| ID | USER | FREQUENCY | AVG_TIME | MAX_TIME | MIN_TIME | EXECUTE_TIME | LAST_TIME | SQL |
------ ------ ----------- ---------- ---------- ---------- -------------- --------------- -------------------------------
| 0 | cc | 1 | 13 | 27 | 27 | 27 | 1457442294297 | select count(*) from catworld |
------ ------ ----------- ---------- ---------- ---------- -------------- --------------- -------------------------------
1 row in set (0.00 sec)
mysql>
查看慢查询
代码语言:javascript
复制mysql> show @@sql.slow;
Empty set (0.00 sec)
mysql>
查看SQL统计
代码语言:javascript
复制mysql> show @@sql.sum;
------ ------ ------ ------ ------ ------ -------------- -------------- ---------------
| ID | USER | R | W | R% | MAX | TIME_COUNT | TTL_COUNT | LAST_TIME |
------ ------ ------ ------ ------ ------ -------------- -------------- ---------------
| 1 | cc | 8 | 0 | 1.00 | 1 | [0, 0, 0, 8] | [5, 3, 0, 0] | 1457442532080 |
------ ------ ------ ------ ------ ------ -------------- -------------- ---------------
1 row in set (0.00 sec)
mysql>
mysql> show @@sql.sum.user;
------ ------ ------ ------ ------ ------ -------------- -------------- ---------------
| ID | USER | R | W | R% | MAX | TIME_COUNT | TTL_COUNT | LAST_TIME |
------ ------ ------ ------ ------ ------ -------------- -------------- ---------------
| 1 | cc | 8 | 0 | 1.00 | 1 | [0, 0, 0, 8] | [5, 3, 0, 0] | 1457442532080 |
------ ------ ------ ------ ------ ------ -------------- -------------- ---------------
1 row in set (0.00 sec)
mysql>
查看表统计
代码语言:javascript
复制mysql> show @@sql.sum.table;
------ ---------- ------ ------ ------ ----------- ----------- ---------------
| ID | TABLE | R | W | R% | RELATABLE | RELACOUNT | LAST_TIME |
------ ---------- ------ ------ ------ ----------- ----------- ---------------
| 0 | catworld | 5 | 0 | 1.00 | NULL | NULL | 1457442518224 |
| 1 | abc | 3 | 0 | 1.00 | NULL | NULL | 1457442532080 |
------ ---------- ------ ------ ------ ----------- ----------- ---------------
2 rows in set (0.01 sec)
mysql>