MySQL slow query and slow query log analysis

Source: Internet
Author: User

Enable the slow query record function. Next, let's analyze the content of the slow query:

 

Select count (distinct. name) from cp_paycard as a left join cp_reservation as B on. uid = B. UID where. type = 2 and B. cpparkid = '000000' and B. businesstype in (2013) and validenddate> '2017-07-05 23:59:59 ';
# User @ host: Root [root] @ localhost [127.0.0.1]
# Query_time: 0 lock_time: 0 rows_sent: 1 rows_examined: 275

D: \ appserv \ mysql \ bin \ mysqld-nt, version: 5.0.45-Community-NT-log (MySQL Community edition (GPL). Started:
TCP/IP Port: 3306, named pipe: (null)
Time id command argument
# Time: 130705 11:17:32
# User @ host: Root [root] @ localhost [127.0.0.1]
# Query_time: 0 lock_time: 0 rows_sent: 1 rows_examined: 6
Use 51 Park;
Select nextrun from uchome_cron where available> '0' order by nextrun limit 1;
# User @ host: Root [root] @ localhost [127.0.0.1]
# Query_time: 0 lock_time: 0 rows_sent: 144 rows_examined: 144
Select * From uchome_config;
# User @ host: Root [root] @ localhost [127.0.0.1]
# Query_time: 0 lock_time: 0 rows_sent: 1 rows_examined: 275

 

[Description]
Queries Total: Total number of queries unique: Number of SQL statements after deduplication
Sorted by: sorts the output report content
The most important slow SQL statement statistics, 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 belongs
Users, which user and IP address account for the percentage of SQL statements executed by all users
Query Abstract: Abstract SQL statement
Query sample, SQL statement

 

 

Related Article

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.