Last active
November 23, 2023 13:07
-
-
Save matsuu/8dde4ba0eebbeefe9db1c308b343b765 to your computer and use it in GitHub Desktop.
performance_schemaを使用したスロークエリー抽出
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
-- ORDER BYとLIMITは必要応じて適宜修正 | |
-- VIEWを作成すると便利 | |
SELECT | |
count_star AS cnt, | |
sum_timer_wait/1e12 AS sum, | |
min_timer_wait/1e12 AS min, | |
avg_timer_wait/1e12 AS avg, | |
max_timer_wait/1e12 AS max, | |
sum_rows_sent AS sumRows, | |
sum_rows_sent/count_star AS avgRows, | |
schema_name AS db, | |
digest_text AS query | |
FROM performance_schema.events_statements_summary_by_digest | |
ORDER BY sum DESC | |
LIMIT 10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment