Created
October 21, 2013 14:17
-
-
Save gwillem/7084632 to your computer and use it in GitHub Desktop.
Pure SQL to query for MySQL Query Cache Rate
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
-- run with: | |
-- boxes -f db | while read i; do echo -n "$i: "; cat qcache-ratio.sql | mysql -h $i | tail -1; done | sort -nk2 | |
use INFORMATION_SCHEMA; | |
SELECT VARIABLE_VALUE FROM GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_hits' INTO @hits; | |
SELECT SUM(VARIABLE_VALUE) FROM GLOBAL_STATUS WHERE VARIABLE_NAME IN ('Qcache_hits','Com_select') into @total; | |
select round(@hits / @total * 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment