Get the App
SLTechnology News&Howtos  ›  Database  › 

How to query slow query statement in slow query log

Shulou Source: shulou.com Published: 2022-05-31 16:56:41 09月30日 Update

slow query log How to query slow query statements, I believe that many inexperienced people are helpless about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

slow query log

Slow query log, by setting the relevant slow query parameters, you can output slow sql statements to the log, which is the slow query log. In many cases, considering the performance problem, the slow query log is not opened, that is, the output of the slow query log is not performed. Maybe sometimes in order to find slow query statements, it will be temporarily opened. This is a way to find inefficient sql. Let's take a look at the parameters.

>show variables like '%slow%';

www.2cto.com

+------------------+-------+

| Variable_name | Value |

+------------------+-------+

| log_slow_queries | OFF |

| slow_launch_time | 2 |

www.2cto.com

+------------------+-------+

2 rows in set (0.00 sec)

log_slow_queries is turned off by default, and turned on when set to on, with slow query log output. Slow_launch_time Sets the slow query criteria and defines the time value. The minimum setting is 1 second. If the query time exceeds this value, it will be output to the log. To find a sub-second slow query criterion, you can use the microslow-patch provided by percona to break the limit and reduce the slow query time to milliseconds.

After reading the above content, do you know how to query slow query log? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Tags: Query log statement output time problem content parameter method more standard minimum helpless for this inefficiency reason for this that is performance situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Docker Xiaomi Shulou Tech Info Apple