first, MySQL's slow query log opening and storage
1, check whether the SQL records that do not use the index to the slow query log, view the log_queries_not_using_indexes variable;
like "Log_queries_%"
Results:
If the value of the query is off, it indicates that there is no record, set to on to open the record;
Set = on;
2, check the query time Long_query_time, that is, the query time is greater than this value (in seconds), then log SQL to the slow query log;
like "Long_query_time"
Results:
set global long_query_time=0.1; /* Set to 100MS */
reopen a Query window , the value of query Long_query_time is modified to 0.1;
Results:
3, check whether to open the slow query log, variable Slow_query_log;
like "Slow_query_log"
If the value is off, it is not turned on; it should be set to on to open;
Set = on;
4. View the location of the slow query log and view the Slow_query_log_file variable
like "Slow%"
Results:
5, slow query log storage format:
6, Slow query log analysis tool
(1) Mysqldumpslow use, check the Help
(2) View the top 3 of the path in the slow query log of/home/mysql/data/mysql-slow.log;
Results:
MySql5.5 SQL optimization slow query log storage