-
-
Save xaprb/7a012d5be64c1285942c to your computer and use it in GitHub Desktop.
Converts SHOW PROFILES into a more useful profile table.
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
SET @query_id = 1; | |
SELECT STATE, SUM(DURATION) AS Total_R, | |
ROUND( | |
100 * SUM(DURATION) / | |
(SELECT SUM(DURATION) | |
FROM INFORMATION_SCHEMA.PROFILING | |
WHERE QUERY_ID = @query_id | |
), 2) AS Pct_R, | |
COUNT(*) AS Calls, | |
SUM(DURATION) / COUNT(*) AS "R/Call" | |
FROM INFORMATION_SCHEMA.PROFILING | |
WHERE QUERY_ID = @query_id | |
GROUP BY STATE | |
ORDER BY Total_R DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment