In the daily development, often encounter the page open very slow situation, by excluding, determined, is the impact of the database, in order to quickly find the specific SQL, can be logged through the MySQL method.--Open the SQL execution logging
One, why do you want to open this query?The database is a very easy place to create bottlenecks, and now nosql people are talking about the heat, and it's estimated that the database is depressing. MySQL is the most affected by the speed of the
The so-called slow query is the query time of a SQL statement more than the predefined well-defined query time, these statements are to be recorded for the use of statement optimization, the following is how to record the slow query statement method:
A basic tutorial on MySQL slow query log analysis,
0. First, check whether slow query is Enabled:
(1) quick way to run SQL statements
show VARIABLES like "%slow%"
(2) go to my. conf to view the information.
Configuration in my. conf (add it below
Slow query logs can contain session_start () and php projects such as online. in the slow query log file, the code session_start () is always displayed, this line of code is useful in many places. now, what is the problem? how to handle it? ------
One, why do you want to open this query?The database is a very easy place to create bottlenecks, and now nosql people are talking about the heat, and it's estimated that the database is depressing. MySQL is the most affected by the speed of the
MySQL 5.6 Turn on slow query logSlow_query_log = On#turn on slow query 1 or onLong_query_time= 3#record over time in seconds, default is 10sSlow_query_log_file=/data/mysql/dev-service-node2-slow.log#Specify the log file location, can be empty, the
0, first to see whether the current open slow query:
(1) Quick way to run SQL statements
Show VARIABLES like "%slow%"
(2) directly to the my.conf to view.
Configuration in my.conf (add under [mysqld] below)
There are a lot of articles on the web to teach how to configure MySQL server, but considering the different server hardware configuration, the specific application of the difference, those articles can only be used as a preliminary setting
When the system performance reaches the bottleneck, it is necessary to find out those operations on the performance impact of the system is relatively large, here you can use the database slow query log function to record some more time-consuming
The slow query log feature is not turned on by default, and it records a value that executes longer than the parameter Long_query_time (default is 10) and the number of rows accessed exceeds the SQL statement that the parameter
MySQL Slow query1, slow query role?It records all SQL statements that execute more than long_query_time time, helping you to find SQL that executes slowly, so we can optimize these SQL statements.2, how to open the slow query?First we check if the
I. Why should I enable this query? Databases are prone to bottlenecks. Now Nosql is so popular that it is estimated that they are all depressed by databases. The statements that affect the query speed in mysql are very slow. These slow statements
MySQL slow query log and MySQL slow log
Lab environment:OS X EI Captian + MySQL 5.71. Configure MySQL to automatically record slow query logs
View the variable, that is, the configuration information.
show (global) variables like
The slow query log is used to optimize the query statement, the following are several parameters, 5.5 can be later to the subtle (MS)Mysql> Show variables like '%slow% ';+---------------------------+-------------------------------+| variable_name |
MySQL tutorial optimization of the first step should be to troubleshoot problems, to find bottlenecks, and usually the bottleneck and problems need to observe the operation of MySQL to analyze, "view the MySQL health" This article lists some
Go to MySQL database and useShow variables like ' Slow_query_log ';See if the slow query log is turned onValue is off, the slow query log is not turned on, and before we turn on the slow query log, we want to determine whether the query that does
1, PHP slow script log intermittent 502, is caused by the failure of the back-end PHP-FPM, intermittent 502 is generally considered to be caused by the restart of the PHP-FPM process. An intermittent 502 error occurs when the number of child
[Slow query optimization] use MySQL subqueries with caution, especially when you see the DEPENDENTSUBQUERY tag bitsCN.com case study:
Preface:
I have repeatedly stressed the importance of explain in slow query optimization 1 and 2, but sometimes
How does mysql enable slow query to enable the mysql slow query log record bitsCN. the slow query log of commysql is very useful for queries with tracing problems. it can be used to analyze the resource-consuming SQL statements in the current
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.