Performance Schema
MySQL's performance_schema database provides low-level instrumentation of server execution. Use it to find which queries consume the most time, I/O, or locks.
MySQL's performance_schema database provides low-level instrumentation of server execution. Use it to find which queries consume the most time, I/O, or locks.
-- Top queries by total latency
SELECT DIGEST_TEXT, COUNT_STAR,
ROUND(SUM_TIMER_WAIT/1e12, 3) AS total_sec
FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 10;
Sys schema views (sys.statements_with_runtimes_in_95th_percentile) provide friendlier summaries.