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 does slow query refer to in MySQL

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces what the slow query in MySQL refers to. It is very detailed and has a certain reference value. Friends who are interested must finish it!

The method to analyze the query performance of MySQL statements not only uses EXPLAIN output execution plan, but also allows MySQL to record statements that exceed a specified time. We call a SQL statement query that exceeds a specified time as a "slow query".

MySQL slow query is to record slow SQL statements in the log, which needs to be turned on before it can be used.

Write in the configuration file my.cnf of MySQL:

Long_query_time = 10log-slow-queries = / var/lib/mysql/mysql-slow.log

Long_query_time refers to how long the SQL will be logged, in this case, 10 seconds.

The log-slow-queries setting writes the log there (in the example, the slow log will be written to the file / var/lib/mysql/mysql-slow.log). If it is empty, the system will give the slow log a hostname and add slow.log. If the parameter log-long-format is set, all queries that do not use the index will also be logged.

This is a very useful journal. It has little impact on performance (assuming that all queries are fast) and emphasizes the queries that need the most attention (missing indexes or indexes that are not best applied).

The above is all the content of the article "what is slow query in MySQL". Thank you for your reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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