ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

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

2019-08-06 21:16:18  阅读:3053  来源: 互联网

标签:mysql mysql-5-5 slow-log


我正在尝试从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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有