Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the parameters related to MySQL slow log

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

What are the relevant parameters of MySQL slow log? I believe many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Whether slow_query_log=1 # enables slow query logs. 1: enable, 0: disable

Slow_query_log_file=slow.log # specifies the path and name of the slow log file, which can be specified using an absolute path; the default value is' hostname _ slow.log', is located in the datadir directory

Long_query_time=2 # SQL statement run time threshold, only statements with execution time greater than the parameter value will be recorded

Statements detected by the min_examined_row_limit=100 # SQL statement with fewer records than the set value will not be logged to the slow query log, even if the execution time of the statement exceeds the long_query_time threshold

Log_queries_not_using_indexes=1 # records statements that do not use indexes to the slow query log

Log_throttle_queries_not_using_indexes=10 # sets the number of unused indexes logged to the log per minute. Beyond this number, only the number of statements and the total time spent are recorded.

Log-slow-admin-statements=1 # records slow execution of management SQL, such as alter table,analyze table, check table, create index, drop index, optimize table, repair table, etc.

Log_slow_slave_statements=0 # records slow query statements executed from the library

The timestamp parameter of log_timestamps=system # 5.7is added. By default, the timestamp of UTC time zone is recorded to the slow query log, which should be modified to record the system time zone.

Log_output=FILE,TABLE # specifies the output mode of slow log, which can be recorded in log files (FILE, slow log) and database tables (TABLE,mysql.slow_log) from version 5.5 onwards

Slow query logs may grow greatly with the running time of the system, so log rotation needs to be done on a regular basis.

The method to slow down the query log on the online wheel is:

a. Modify the slow log file name

b. Execute the flush slow logs; command to open a new log file

After reading the above, have you mastered the methods of MySQL slow log-related parameters? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report