The database enables slow query logs Modify the configuration file Add the following two sentences to the configuration file my.ini log-slow-queries = C:\xampp\mysql_slow_query.log long_query_time=3 The first sentence is used to define the path of the slow query log (if it is a Linux system, it will involve permission issues) The second sentence is used to define queries that take more than a certain number of seconds as slow queries, in seconds. Check whether the configuration is successful: //View the slow query time, unit: s show variables like "long_query_time"; //View the slow query configuration show status like "%slow_queries%"; //View the slow query log path show variables like "%slow%"; Execute a slow query operation to verify whether the log is recorded: The amount of data in the environment you build is small, so it is difficult to simulate the execution of slow queries. You can use the following statement to simulate instead: SELECT SLEEP(10), name from user where userid=1; View the number of slow queries: show global status like '%slow%'; Thank you for reading, I hope it can help you, thank you for your support of this site! You may also be interested in:
|
<<: How to use rem adaptation in Vue
1: masterha_check_repl replica set error replicat...
Navigation bar creation: Technical requirements: ...
1. What is event delegation? Event delegation: Ut...
tcpdump is a flexible and powerful packet capture...
This article example shares the specific code of ...
1 Download and start Tomcat Go to the official we...
We are in an era of rapid development of mobile In...
Everyone must be familiar with table. We often en...
The author of this article @子木yoyo posted it on hi...
How PHP works First, let's understand the rel...
Full-text indexing requires special query syntax....
This article is the second article about objects ...
question: The commonly used command "ll"...
Use jQuery to implement form validation, for your...
Copy code The code is as follows: <html xmlns=...