数据库
首页 > 数据库> > mysql – 在slow_log表中,sql_text列显示“throttle:index not used’warning(s)suppress”而不是精确查询

mysql – 在slow_log表中,sql_text列显示“throttle:index not used’warning(s)suppress”而不是精确查询

作者:互联网

我正在尝试从slow_log表中找到运行缓慢的查询(因为我没有直接访问服务器来检查慢速日志文件).在sql_text列而不是查询中,它显示“throttle:index not used’warning(s)suppress”.有人可以帮我找到慢速运行的查询.

解决方法:

不幸的是,您不会从mysql.slow_log获取这些查询.为什么?

显然有两种选择

> log_queries_not_using_indexes
> log_throttle_queries_not_using_indexes

根据MySQL Documentation (The Slow Query Log, Paragraph 9)

To include queries that do not use indexes for row lookups in the statements written to the slow query log, enable the log_queries_not_using_indexes system variable. When such queries are logged, the slow query log may grow quickly. It is possible to put a rate limit on these queries by setting the log_throttle_queries_not_using_indexes system variable. By default, this variable is 0, which means there is no limit. Positive values impose a per-minute limit on logging of queries that do not use indexes. The first such query opens a 60-second window within which the server logs queries up to the given limit, then suppresses additional queries. If there are suppressed queries when the window ends, the server logs a summary that indicates how many there were and the aggregate time spent in them. The next 60-second window begins when the server logs the next query that does not use indexes.

这表明您的log_throttle_queries_not_using_indexes已设置为禁止SQL文本.你可以用这个验证

mysql> SELECT @@global.log_throttle_queries_not_using_indexes;

由于它是全局动态变量,因此必须以root @ localhost身份登录并运行

mysql> SET GLOBAL log_throttle_queries_not_using_indexes = 0;

这应该暴露进入mysql.slow_log的新查询,但是你永远不会看到那些先前的慢查询.

你必须运行它

mysql> SELECT @@global.log_output;

如果您看到FILE,则表示存在慢查询日志的文本版本.您必须让您的SysAdmin为您提供所需的慢速日志信息(此时可能需要星巴克GiftCard.如果慢速日志文件包含相同的消息,请将您的星巴克GitftCard取回.)

标签:mysql,mysql-5-5,slow-log
来源: https://codeday.me/bug/20190806/1603328.html