INFORMATION_SCHEMA, For instance, counting the number of sleeping connections can be done with:
mysql> SELECT COMMAND,COUNT(*) TOTAL FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY COMMAND ORDER BY TOTAL DESC;
mysql> SELECT COMMAND,COUNT(*) TOTAL FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY COMMAND ORDER BY TOTAL DESC;
+---------+-------+
| COMMAND | TOTAL |
+---------+-------+
| Sleep | 36 |
| Query | 1 |
+---------+-------+
2 rows in set (0.01 sec)
mysql> SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND='Sleep';
+----------+
| COUNT(*) |
+----------+
| 36 |
+----------+
1 row in set (0.00 sec)
mysql> SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND='Sleep';
+----------+
| COUNT(*) |
+----------+
| 36 |
+----------+
1 row in set (0.00 sec)
No comments:
Post a Comment