A basic tutorial on querying logs and slow query logs in MySQL,
I. query logs
Query all the queries in MySQL by using "-- log [= file_name. Because all the queries, including all the select statements, are recorded, and the size is relatively large,
This article describes how to query logs and slow query logs in MySQL. It also describes how to use the Mysqldumpslow log analysis tool that comes with MySQL. For more information, see
I. query logs
Query all the queries in MySQL by using "-- log [=
First we look at the log in MySQL, mainly includes: error log, query log, slow query log, transaction log, binary log;Logs are an important part of the MySQL database. The log file records the changes that occurred during the MySQL database
Directory
I. Optimization Overview
Ii. query and index optimization Analysis
1. performance bottleneck locating
Show command
Slow query log
Explain analysis Query
Profiling Analysis Query
2 Index and Query Optimization
Iii. Configuration
An introduction
The principle of two indexes
Three-indexed data structures
Three MySQL index management
Four Test indexes
Five correct use index
Six query optimization artifact-explain
The basic steps of seven-slow query
MySQL index principle overview and slow query optimization practices MySQL has become the preferred relational database for most Internet companies thanks to its outstanding performance, low cost, and rich resources. Although the performance is
The slow query log of the MySQL database is an important tuning auxiliary log, but the log format of the MySQL default record is not friendly enough to read, which is determined by the MySQL logging rule, capturing one record, although the recorded
First, IntroductionPt-query-digest is a tool for analyzing slow queries for MySQL, which analyzes Binlog, general log, Slowlog, It can also be analyzed using showprocesslist or MySQL protocol data crawled by tcpdump. The analysis results can be
(1) Configuration Open
Linux:
Add the following statement to the MySQL configuration file my.cnf:
Log-slow-queries=/var/lib/mysql/slowquery.log #指定日志文件存放位置, can be null, the system will give a default file Host_name-slow.logLong_query_time=5
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.