Mysqldumpslow Analysis Slow query log and explain analysis MySQL queries structure

Source: Internet
Author: User
Tags mysql query

Use of Mysqldumpslow:
For example, we want to query the first 5 log messages by time, in the following format:
Mysqldumpslow-s t-t 5/var/log/mysql/slowquery_20180303.log

Parameter description:
-S: Sort by lock time L, number of records returned R, query time t, record number of times C, reverse can be added R
-T: How many records before querying
-G: Supports regular expressions, and ignores case

By the way explain
Explain is used to analyze the MySQL query structure with the main focus on four parameter values:
Type, key, rows, extras
Access type Type:al worst, ref,eq_ref centered, null best

All->index->range->ref->eq_ref->const or System->null

There is no use index Key:key is empty no index is used
Find the number of rows to read for the desired record: the smaller the rows,rows value, the better.
Extras: In what way a required record is found, a using Filesort or using temporary indicates inefficiency, only index is indexed, where used uses the where filter condition, impossible where No use to index

Mysqldumpslow Analysis Slow query log and explain analysis MySQL queries structure

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.