Common mysql slowquery log analysis tools

Source: Internet
Author: User

The commonly used mysql slowquery log analysis tool has a good article about mysql optimization, which is nothing more than starting with hardware and SQL statements. Of course, the most important thing here is SQL statements, therefore, we need to trace these SQL statements frequently. Mysql slow log is a log tool used to record SQL statements that have been executed for a long time (beyond long_query_time seconds! There are two ways to enable slow log: 1. in cnf, log-slow-queries [= file_name] 2 is used. When the mysqld process is started, specify the-log-slow-queries [= file_name] Option mysqldumpslowmysqlslamyprofimysql-explain-slow-logmysqllogfilter ------------------- 1. slow query log analysis tool officially provided by mysqldumpslowmysql. the main function is to Count the number of occurrences of different slow SQL statements (Count), the maximum execution Time (Time), the total Time consumed (Time), and the Lock wait Time (Lock ), the total number of Rows sent to the client (Rows), the total number of Rows scanned (Rows), the user and the SQL statement itself (abstracted format, such as limit 1, 20 with limit N, N indicates ). 2. A log analysis tool launched by mysqlslahackmysql.com (This website also maintains mysqlreport, mysq1_xchk, and other useful mysql tools), which is very powerful in general. data reports are very helpful for analyzing the causes of slow queries, including execution frequency, data volume, and query consumption. the format description is as follows: total queries (queries total), number of de-duplicated SQL statements (unique) The most important slow SQL statement statistics in sorting the output report content (sorted, including average execution time, lock wait time, total number of result rows, and total number of scanned rows. count, the number of SQL executions and percentage of the total slow log Count. time, execution Time, including the total Time, average Time, minimum, maximum Time, and Time as a percentage of the total slow SQL Time. 95% of Time removes the fastest and slowest SQL statements, and the SQL Execution Time with a coverage rate of 95%. lock Time, the waiting Time. 95% of Lock, 95% of slow SQL wait Lock time. rows sent, the number of result Rows, including average, minimum, and maximum. rows examined: number of Rows scanned. database, which Database is Users, which user, IP address, percentage of SQL executed by all Users Query abstract, abstract SQL statement Query sample, SQL statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.