MySQL · SQL
SELECT LEFT(digest_text, 160) AS statement,
schema_name,
count_star AS calls,
ROUND(sum_timer_wait / 1e12, 1) AS total_seconds,
ROUND(avg_timer_wait / 1e9, 2) AS avg_ms,
sum_rows_examined AS rows_examined,
sum_rows_sent AS rows_sent
FROM performance_schema.events_statements_summary_by_digest
WHERE schema_name IS NOT NULL
ORDER BY sum_timer_wait DESC
LIMIT 20Needs something on the server: performance_schema must be ON (it is by default since 5.6).
This query is part of the "MySQL health" pack: connect the database in DataRunner and install the whole pack — queries, dashboard and checks — at once.