1. Slow Query function
Slow queries can help us record all SQL statements over Long_query_time, which facilitates SQL optimization.
2. Check the open status of slow query
Before you start a slow query, you need to determine if the slow query is turned on and execute the following command.
You can see that the value of log_slow_queries is off and is off. To turn on slow queries, you need to add them under My.ini mysqld.
Log-slow-queries=d:/xampp/mysql/data/mysql-slow.log (save path, can be set according to your needs)
long_query_time=2 (the maximum length of the query, which is recorded in the log if it exceeds this time)
After the add is complete, restart the MySQL service.
3. View Slow Query status
Through the above command, you can see the open status of slow query, slow query the specified execution time, slow query log and other information
4. Change the time of slow query by command
In addition to modifying the My.ini file, you can also modify the execution time of a slow query by using a command.
Windows MySQL slow query open operation process