MySQL Slow Query Log Analyzer
Summarise a MySQL slow query log: queries grouped by fingerprint and ranked by total time, with call counts, maximum time and rows examined per row sent.
Free · No sign-up · Your inputs stay in your browser
Input
Summarise a MySQL slow query log
Output
2 distinct queries
| Query | Calls | Total s | Share | Max s | Examined / sent |
|---|---|---|---|---|---|
| SELECT country, COUNT(*) FROM customers c JOIN orders o ON o.customer_id = c.id WHERE o.status IN (?+) GROUP BY country | 1 | 7.88 | 63.5% | 7.88 | 87,517 |
| SELECT * FROM orders WHERE customer_email = ? ORDER BY created_at DESC LIMIT ? | 2 | 4.52 | 36.5% | 2.40 | 498,211 |
Queries are grouped by fingerprint, with literals replaced by ? and IN lists collapsed, the way pt-query-digest does, and ranked by total time: a 50 ms query run 10,000 times costs more than one 8-second report. Rows examined per row sent above a few hundred usually means a missing index.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Turning the log on
Set slow_query_log = ON, long_query_time to a threshold in seconds (0.5 is a common start) and optionally log_queries_not_using_indexes. The log path is in slow_query_log_file. The slow query log documentation covers the options; managed services such as RDS expose it through parameter groups.
Rows examined per row sent
A query that examines 500,000 rows to return one is doing a scan where an index lookup should be. That ratio is often more useful than time, because time varies with load and the ratio does not.