This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23809|Reply: 3

[Source] Slow queries for MySQL performance optimization

[Copy link]
Posted on 11/12/2021 3:16:07 PM | | | |
MySQL data provides a slow query function, sets a threshold, and records SQL statements that exceed this threshold, which is convenient for us to analyze the bottlenecks of the system in the database and optimize SQL statements. Turning on slow log queries increases the strain on the database.

Review:

MySQL enables generic query logs and slow query logs
https://www.itsvse.com/thread-7287-1-1.html

How to turn on slow query logging in Mysql
https://www.itsvse.com/thread-1767-1-1.html

To enable MySQL slow query, you need to set the following three parameters:

slow_query_log Slow query is on
slow_query_log_file Location of the slow query log (this directory requires the writeable permission of the MySQL running account, which is generally set to the MySQL data storage directory)
long_query_time How many seconds does the query take to record

Temporary settings (restart failure)

The SQL command is as follows




Permanent setting

Find the my.cnf configuration file and add it below under [mysqld]:

(End)





Previous:Jenkins (6) ThinBackup plug-in for data backup
Next:Spring Boot dynamically sets the Topic or GroupId of Kafka
Posted on 11/13/2021 4:16:17 AM |
Posted on 11/14/2021 12:08:10 AM |
Let's take a look...
Posted on 12/1/2021 4:39:08 PM |
Not bad...
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com