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
When using <a href="" onclick="&...
Here's the thing: Everyone knows about "...
Table of contents 1. Installation 2. Introducing ...
Since I have parsed HTML before, I want to use Vu...
This article example shares the specific code of ...
This article shares the specific code of JS to ac...
1. Complex SQL queries 1.1. Single table query (1...
The project requirements are: select date and tim...
This article shares the specific code of JavaScri...
It has been three or four months since I joined Wo...
//MySQL statement SELECT * FROM `MyTable` WHERE `...
The detailed installation process of mysql5.7.21 ...
Table of contents npm download step (1) Import (2...
Note: This table is quoted from the W3School tuto...
Recently, I encountered a problem of whether the d...