MYSQL slow query records database statement bitsCN.com needs to enable a slow query output organ: log_slow_queries. You can set it in the MySQL configuration file (my. ini/my. cnf) or through the MySQL client. The advantage of the second method is
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,
In MySQL5.1 slow query logs, slow queries without indexes are the same as those with indexes. To prevent slow queries without indexes from being recorded in slow query logs, use -- log
In slow query logs of MySQL 5.1, slow queries without indexes
General steps for MySQL optimization:
1. Run the show status command to check the execution efficiency of various SQL statements.
Show status provides the status information of the msyql Server
Generally, we only need to know the commands
When the -- log-slow-queries [= file_name] option is enabled, mysqld writes a log file containing all SQL statements whose execution time exceeds long_query_time seconds. Obtaining the initial lock time is not counted as the execution time.
If the
Skills and optimization of SQL statements learned by mysql, and skills of mysqlsql statementsI. use regular expressions in SQL
Select name, email from user where email Regexp "@ 163 [.,] com $ ";
The use of Regexp in SQL statements has a great
Interview , the interviewer may ask you what work you've done before. Through your answer, he can determine whether you have ever done operation. Below I give some answers, hope can help you. 1. Look at the monitoring center, to deal with the
1 Check the MySQL configuration of the two parameters max_connections "maximum number of connections" and wait_timeout "connection idle Wait Long", if the default value, please modify:
View the value of the maximum number of connections.
In the face of rapid business development, one of the important tasks of DBA is to discover the inefficient SQL statements in the database in time, some can immediately start to solve (such as lack of appropriate indexes), and some need to feedback
About MySQL efficiency optimization typically uses the following two ways to locate execution-less efficient SQL statements.
With slow query logs locating those SQL statements that perform less efficiently, when started with
Logs in MySQL include: error log, binary log, General query log, slow query log, and so on. Here is the main introduction of the more commonly used two features: General query log and slow query log.1) General query log: Records established client
Recently, a development team complained that our platform contains MySQL cluster not, always reported the MySQL "Heartbeat Error", analyzed the logs they collected, did not find the network between the MySQL cluster node problem, but found a very
MongoDB slow query record in MySQL, the slow query log is often used as the basis for us to optimize the database, is there a similar function in MongoDB? The answer is yes, that's MONGO database. Profiler. Not only, but there are some more
Mysqldumpslow is a slow query log analysis tool with MySQL, as its name implies, queries those SQL statements that are slow to query, thus analyzing the reason why SQL query efficiency is slow.In general, the results of a Mysqldumpslow group query
The following two methods are generally used to locate SQL statements with low execution efficiency.
* Use the slow query log to locate SQL statements with low execution efficiency. When the -- log-slow-queries [= file_name] option is enabled,
Use the slow query log to locate SQL statements with low execution efficiency. when the -- log-slow-queries [file_name] option is enabled, mysqld will write a log file containing all SQL statements whose execution time exceeds long_query_time. by
Mysql enables slow query logs and queries-windows, mysql-windows
MySQL slow query Configuration
1. What is the use of slow queries?
It records all SQL statements that have been executed longer than long_query_time, and helps you find slow SQL
Use MySQL 5.7.9 as the monitoring database for Zabbix 2.4.7. Some time ago opened a slow query log, and later found that the slow query log expanded to 700M
See the last 100 most of them are 0.1 seconds later want to change, previously is the
Linux enable MySQL slow query
The code is as follows
Copy Code
Vim/etc/my.cnf[Mysqld]Slow-query-log = on # Open slow query functionSlow_query_log_file =/usr/local/mysql/data/slow-query.log # Slow query log store path and
The MySQL slow query log analysis is now provided by a variety of tools, the most original Mysqldumpslow, full-featured Mysqlsla and Percona pt-query-digest; These tools greatly improve the DBA's ability to analyze the performance of the database,
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.