In development projects, we can monitor SQL with efficiency issues through MySQL's slow query log. The following commands enable logging: Find the directory for slow query log files show variables like 'slow_query_log' Set the slow log file directory set global slow_query_log_file='home/mysql/sql_log/mysql_slow.log' Whether to record SQL statements that do not use indexes in the log set global log_queries_not_using_indexes=on Set the number of seconds that SQL statements that exceed this limit are recorded in the log. set global long_query_time=1 Here this time is usually quite large, it is best to set it to 0.01s, depending on your own situation. Now let's actually execute the command: First check the log file location: It can be seen that our slow_query_log is off, which means that we have not enabled the slow query log. Use Then use the command to check whether the value of long_query_time is set. If it is 0, it means that all queries will be recorded in the log. Let's take a look at the log storage format: The format is as follows: #Query execution time#Time:140606 12:30:17 #SQL execution host information #User@Host:root[root] @ localhost [] #SQL execution information, query execution time, lock time, number of rows sent and number of rows scanned #Query_time:0.000031 Locak_time:0.000000 Rows_sent:0 Rows_examined:0 #SQL execution time SET timestamp=1402029017; #Executed SQL content show tables; Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed tutorial on installing JDK8 on Linux system (CentOS7 installation)
>>: Summary of webpack's mobile adaptation solution
Mysql installation, configuration, and optimizati...
To achieve the association of the frame window, th...
Find the problem Let's look at the problem fi...
Why should we use CSS animation to replace JS ani...
Install the nvidia graphics card driver under Ubu...
In rows, dark border colors can be defined indivi...
Table of contents Advantage 1: Optimization of di...
Effect display: Environment preparation controlle...
Table of contents 1. Installation Environment 2. ...
The Docker images we usually build are usually la...
Table of contents Preface 1. What is a closure? 1...
This article shares the installation and configur...
If you have installed the Win10 system and want t...
1. Prepare a new disk and format it with the same...
How to define complex components (class component...