Created
May 25, 2011 09:17
-
-
Save davidreuss/990652 to your computer and use it in GitHub Desktop.
mysql queries per. second estimated
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 MAX( -- use MAX to force aggregation | |
IF(variable_name='Questions' -- no. of queries sent to server | |
, CAST(variable_value AS unsigned) -- make integer value | |
, 0 -- ignore if not 'Questions' | |
) | |
) | |
/ -- divide by | |
MAX( -- use MAX to force aggregation | |
IF(variable_name='Uptime' -- no. of seconds the server is up | |
, CAST(variable_value AS unsigned) -- make integer value | |
, 0 -- ignore if not 'Uptime' | |
) | |
) AS queries_per_second | |
FROM information_schema.GLOBAL_STATUS | |
WHERE variable_name in ('Questions', 'Uptime'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from http://forge.mysql.com/tools/tool.php?id=144