Created
February 28, 2013 08:01
-
-
Save spetrunia/5055059 to your computer and use it in GitHub Desktop.
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 STRAIGHT_JOIN | |
LOWER(gs0.VARIABLE_NAME) AS variable_name, | |
gs0.VARIABLE_VALUE AS variable_value_0, | |
gs1.VARIABLE_VALUE AS variable_value_1, | |
(gs1.VARIABLE_VALUE - gs0.VARIABLE_VALUE) AS variable_value_diff, | |
(gs1.VARIABLE_VALUE - gs0.VARIABLE_VALUE) / 10 AS variable_value_psec, | |
(gs1.VARIABLE_VALUE - gs0.VARIABLE_VALUE) * 60 / 10 AS | |
variable_value_pminute | |
FROM | |
( | |
SELECT | |
VARIABLE_NAME, | |
VARIABLE_VALUE | |
FROM | |
INFORMATION_SCHEMA.GLOBAL_STATUS | |
UNION ALL | |
(SELECT | |
'', | |
SLEEP(10) | |
FROM | |
INFORMATION_SCHEMA.GLOBAL_STATUS LIMIT 1) | |
) AS gs0 | |
JOIN | |
( | |
SELECT | |
VARIABLE_NAME, | |
VARIABLE_VALUE | |
FROM | |
INFORMATION_SCHEMA.GLOBAL_STATUS | |
UNION ALL | |
(SELECT | |
'', | |
0 | |
FROM | |
INFORMATION_SCHEMA.GLOBAL_STATUS LIMIT 1) | |
) as gs1 USING (VARIABLE_NAME) | |
WHERE | |
gs1.VARIABLE_VALUE != gs0.VARIABLE_VALUE | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment