Monitoring SQL statement execution efficiency based on MySQL slow log
Enable MySQL log-slow-queries (slow query record).
In the Linux environment to find the My.cnf file (generally in/etc/mysql/), and then you may find that the file can not be
Need to open a slow query output of an organ: log_slow_queries. Can be set in the MySQL configuration file (my.ini/my.cnf) or through the MySQL client temporary settings. The advantage of the second approach is that you can take the settings into
But how do you find out which SQL statement is executing too long? Can be found through the MySQL slow log, detailed below.
First find MySQL configuration file my.cnf, according to different versions of MySQL open slow query configuration is not
Slow query for the system query time exceeds the value of long_query_time, analysis of slow query is the basis for optimizing SQL, the default clear MySQL slow query for the shutdown status, you can
Show variables where variable_name = '
The first step should be to do is to troubleshoot problems, to find bottlenecks, so, start with the logTurn on slow query log
Mysql>show variables like "%slow%";
To view the slow query configuration, not add to the MY.CNF, as
Slow queryWe know that the general application system, MySQL read and write ratio of about 10:1, and the general insert and update operations rarely appear performance problems, encountered the most problems, but also the most prone to problems, or
Reference: 5 kinds of MySQL log analysis tools to compete http://blog.csdn.net/gzh0222/article/details/103844751.mysql-log-filter Tool Script Usage instructions:An analysis tool found on Google code. Two executable scripts for Python and PHP are
First, IntroductionTurn on the slow query log, you can let the MySQL record query over a specified time of the statement, through the location analysis of performance bottlenecks, to better optimize the performance of the database system.Second,
MySQL's slow query log is a log record provided by MySQL, which is used to record a statement in MySQL that has a response time exceeding the threshold, which refers to SQL that runs longer than the Long_query_time value, and is recorded in the slow
MySQL Slow query:Check if log on slow query is turned on:
Show variables like ' log_slow_queries ';
View SQL that is slower than how many seconds are logged to the log file:
Show variables like ' long_query_time ';
Configure Logging
A. Command Actionsa) database Query Current connection:showprocesslist;&&show status;b) Database viewing status:status;c) view CPU usage:topd) Refresh report Memory usage:free–b–s5 Free command: Total: the total amount of physical memory.
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
Before Windows mysql5.6.20 using mysqldumpslow.pl to analyze slow logs, today saw a tool pt-query-digest, originally intended to be installed on Windows, resulting in the execution of C: \ on Windows Program Files\mysql\mysql Server 5.6\bin>pt-query-
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
Use MySQLSlowLog to solve the problem of high usage of MySQLCPU bitsCN.com
Use MySQL Slow Log to solve the high CPU usage problem of MySQL
In a Linux VPS system, sometimes MySQL occupies a high CPU, resulting in a high system load. This is
Mysql slow query logs are very useful for queries with tracing problems. You can analyze the resource-consuming SQL statements in the current program. How can I open mysql slow query log records, next, we will introduce you in detail
Mysql slow
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
In Linux, enable MySQL slow query. The configuration file of MySQL in Windows is usually my. cnf. Find [mysqld] and add log-slow-queriesdatamysqldatas.
In Linux, enable MySQL slow query. The configuration file of MySQL in Windows is usually my. cnf.
Slow query log: all SQL statements that run longer than long_query_time in MySQL slow query log records help you find slow SQL statements, so that we can optimize these SQL statements. Slow query log configuration: by default, mysql does not enable
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.