MySQL Slow Query Log Analyzer
MySQL allows logging slow queries to a slow log file, according to a configured execution duration threshold. Parsing the slow log with tools such as pt-query-digest will allow you to quickly locate the most used and slowest SQL queries in the application. Optimizing these queries can be done automatically using EverSQL Query Optimizer.
Step 1
To start optimizing, configure MySQL to log slow queries by running these statements from your SQL client:
Step 1
To start optimizing, configure MySQL to log slow queries by running these statements from your SQL client:
set global slow_query_log_file ='/var/log/mysql/slow.log'; -- Set slow log path
set global long_query_time = 5; -- If a query takes longer than this many seconds, it will be logged.
Step 2
Next, let's transform the slow log to a digested JSON report, by running the following pt-query-digest command:
Next, let's transform the slow log to a digested JSON report, by running the following pt-query-digest command:
./pt-query-digest --output json slow.log > digest.log
Step 3
Once you got the report exported to a file, please upload it:
Once you got the report exported to a file, please upload it:
Drag & drop, or click to upload
This report presents slow SELECT queries, grouped by the query fingerprint, and reported in the order configured for pt-query-digest (by default, the ones with the highest total duration first).
Slow Queries
Query | Avg. Duration | Total Duration | Executions Count | Status |
---|