In web development, we often write some SQL statements. A bad SQL statement may make your entire program very slow. After 10 seconds, users usually choose to close the webpage, how to optimize SQL statements to find out SQL statements that have been
This article mainly introduces the MySQL index and slow query optimization tutorials shared by the technical team of Meituan network, and analyzes some optimization solutions based on the actual disk IO situation, which is very recommended! If you
Automatic slow query and Analysis Based on Python and automatic mail sendingConsists of two program files. The first program implements slow query analysis and file upload.
#! /Usr/local/python27/bin/python2.7from fabric. api import * from fabric.
1 Slow query definitionMySQL records all SQL statements that execute a time threshold that exceeds the Long_query_time parameter setting. The slow query log is the log that logs these SQL.
2 Open Slow query logLocate the MySQL configuration file my.
First, the concept part:As the name implies, the slow query log is a long execution of query, which is what we often call slow query, by setting--log-slow-queries[=file_name] to open the function and set the record location and file name, The
MySQL has a log, called the slow query log , is mainly used to record some time-consuming queryFor With this log we can analyze what operations are impacting performance, and we need toPerform some optimization measures.View open StatusAbove is the
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
When the MySQL server is abnormal ( slow ), first of all to consider whether the SQL statement caused the database slow, if the situation is more urgent, we will SHOW full processlist immediately; To see, but I recommend that you use the- e
First, open the slow query log1. Query slow query time default 10 seconds like "Long_query_time"2. Query slow query log file address like "%slow%"3. If the slow query log is not turned on, configure the item under My.ini [MYSQLD] and restart the
The query is the most problematic database response. Most databases now provide the means to help with performance analysis. Oracle, for example, will help you find the slow statements directly and provide an optimization solution. In MySQL, you
As we all know, in the case of large traffic, can add node or change the schema can effectively alleviate the database pressure, but all the origin, all from a single MySQL start. The following summarizes some of the experiences that have been used
ObjectiveRecently help the company to optimize the database, with the previous learning, step-by-step learning knowledge for practice, finally is the speed rub up, a query originally to execute more than 1 minutes now only need 3 seconds.Now the
5.2 MySQL server log---------------------mysql log types: 1. Error log: Problems encountered when starting, running, stopping mysqld 2, common query log: establishing client connections and receiving from clients Received statements 3, binary log:
Tag:handler Execution time file max low memory sql query request read err There are many articles on the web to teach how to configure MySQL server, but considering the different server hardware configuration, the
as the name implies, the slow query log is a long execution of query, that is, we often say slowquery, by setting--log-slow-queries[=file_name] to open the function and set the record location and file name. The slow query log is a simple text
DescriptionOperating system: CentOS 5.X 64-bitMySQL version: mysql-5.5.35MySQL configuration file:/etc/my.cnfMySQL Database storage directory:/data/mysqlto achieve the purpose: turn on the MySQL Slow query log feature, install the use of MySQL slow
1, configuration onLinux:Added in MySQL config file my.cnfLog-slow-queries=/var/lib/mysql/slowquery.log (Specify the log file location, can be empty, the system will give a default file Host_name-slow.log)long_query_time=2 (record over time, default
1. Slow Query functionSlow queries can help us record all SQL statements over Long_query_time, which facilitates SQL optimization.2. Check the open status of slow queryBefore you start a slow query, you need to determine if the slow query is turned
Slow query logs are composed of some SQL statements. When the query time exceeds the value of long_query_time, the slow query log is generated. The minimum value of longquerytime is 1 s and the default value is 1 s.
Slow query logs are composed of
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.