Mysqlslowlog is a log tool used to record SQL statements with a long execution time (beyond long_query_time seconds. you can enable slowlog in either of the following ways: 1. in cnf, log-slow-queries [file_name] 2 is used to specify the log mysql management tool when the mysqld process is started.
Mysql slow log is a log tool used to record SQL statements with a long execution time (beyond long_query_time seconds.
Enable slow log
There are two activation methods:
1. in my. cnf, log-slow-queries [= file_name]
2. when the mysqld process is started, specify the-log-slow-queries [= file_name] option
Comparison of five common tools
Mysqldumpslow, mysqlsla, myprofi, mysql-explain-slow-log, mysqllogfilter
Mysqldumpslow is the log analysis tool for slow query officially provided by mysql. The Output Chart is as follows:
The main function is to count slow SQL statements
Number of occurrences (Count ),
Maximum execution Time (Time ),
Total Time consumed ),
Lock ),
Total number of Rows sent to the client (Rows ),
Total number of Rows scanned (Rows ),
The user and the SQL statement itself (abstract the format, for example, limit 1, 20 is represented by limit N, N ).
Mysqlsla, a log analysis tool launched by hackmysql.com (This website also maintains mysqlreport, mysq1_xchk, and other useful mysql tools)
Data reports are very helpful for analyzing the causes of slow queries, including execution frequency, data volume, and query consumption.