Created
November 15, 2016 07:53
-
-
Save dungmanh88/c75f5e630454dea01c9f2c0c4a834198 to your computer and use it in GitHub Desktop.
Profiling mysql query
This file contains hidden or 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
mysql> set profiling=1; | |
mysql> // command | |
mysql> show profiles; | |
mysql> show profile for query 1; | |
mysql> set @query_id=1; | |
mysql> 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