Last active
April 22, 2024 19:23
-
-
Save ronaldbradford/219aa350000472711af18ad572e90661 to your computer and use it in GitHub Desktop.
A summary of incoming MySQL Connections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT /* Host connections */ SUBSTRING_INDEX(host, ':', 1) AS host, user, COUNT(*) AS host_connections | |
FROM information_schema.processlist | |
GROUP BY SUBSTRING_INDEX(host, ':', 1), user; | |
SELECT /* Running connections per source/user/schema */ host,user,db,command,COUNT(*) AS running | |
FROM information_schema.processlist | |
WHERE command NOT IN ('Sleep','Daemon','Binlog Dump') | |
GROUP BY host, user; | |
SELECT /* thread counts */ variable_name, variable_value | |
FROM performance_schema.global_status | |
WHERE variable_name LIKE 'thread_%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment