Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT q, COUNT(*) AS c, avg(query_time) as avg_query, avg(lock_time), COUNT(*) * AVG(query_time) as total_time
- FROM (
- SELECT regexp_replace(regexp_replace(regexp_replace(sql_text, "'.*?'", '?'), 'IN \\(.*?\\)', 'IN ?'), '\\d+', '?') as q, query_time, lock_time from mysql.slow_log
- WHERE DATEDIFF(start_time, NOW()) < 30
- ) a
- GROUP by q
- ORDER BY total_time DESC
- LIMIT 10;
Add Comment
Please, Sign In to add comment