In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to quickly locate the place where the php program runs slowly, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Set the slow query parameter of mysql: long_query_time
Displays the current slow query time:
Show variables like 'long_query_time'
Modify slow query time:
Set long_query_time=1
But after restarting mysql, long_query_time is still the value in my.ini
By default, mysql does not record slow queries. You need to specify slow queries for records when you start mysql. How to operate)
At this time, if the sql execution time is greater than the modified slow query time, it will be recorded in the log file. The slow execution of the php program can be located by querying the log information, and the sql running time can be analyzed through the explain statement.
Stolen SQL statement:
# View the status of slow query related parameters show variables like'% quer%';# View the number of slow query sql show status like'% slow_queries%';# enable slow query log set global slow_query_log = on;# set slow query time to 1 second set global long_query_time = 1 * add explainEXPLAIN SELECT report_id FROM tb_sys_report;show variables like'% quer%' before select Query the location of the slow log as shown in the following figure to understand the meaning of the three circled variables: long_query_time:10.000000: it means that sql is recorded in the slow log after querying for more than 10 seconds. Slow_query_log:OFF: whether the slow log is enabled slow_query_log_file: path: the full path of the log where the slow query sql exists
Steps:
1. Locate slow query sql based on slow log
2. Use explain and other tools to analyze sql
3. Modify sql or let sql follow the index as much as possible.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.