mysql 慢查询日志记录不慢的查询?

mysql 设置慢查询开启后,在慢日志里记录大量SQL,因没有对外服务访问,所以很诡异,查看发现是metric mysql_exporter产生的查询。但查看每条慢查询执行时间都非常短。因为大量写入所以帮看下是什么原因导致。
mysqldumpslow 命令生成的统计如下:

Reading mysql slow query log from mysqld.log
Count: 1185  Time=0.00s (0s)  Lock=0.00s (0s)  Rows_sent=5.0 (5925), Rows_examined=5.0 (5925), Rows_affected=0.0 (0), root[root]@[127.0.0.1]
  SELECT
  page_size, compress_ops, compress_ops_ok, compress_time, uncompress_ops, uncompress_time
  FROM information_schema.innodb_cmp

Count: 1185  Time=0.00s (0s)  Lock=0.00s (0s)  Rows_sent=5.0 (5925), Rows_examined=5.0 (5925), Rows_affected=0.0 (0), root[root]@[127.0.0.1]
  SELECT
  page_size, buffer_pool_instance, pages_used, pages_free, relocation_ops, relocation_time
  FROM information_schema.innodb_cmpmem

参与5

2同行回答

zhendazhenda数据库管理员昆仑银行
MariaDB [(none)]> SELECT @@long_query_time, @@log_queries_not_using_indexes;| @@long_query_time | @@log_queries_not_using_indexes || 10.000000 | 1 |显示全部

MariaDB [(none)]> SELECT @@long_query_time, @@log_queries_not_using_indexes;


| @@long_query_time | @@log_queries_not_using_indexes |


| 10.000000 | 1 |

收起
软件开发 · 2020-08-27
浏览1448
  • 值分别是10和打开,从这两个变量看不出问题的原因呀。
    2020-08-27
renou2012renou2012数据库管理员KE
检查下数据库参数  log_queries_not_using_indexes 是否是开启状态SELECT @@long_query_time, @@log_queries_not_using_indexes; https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_queries_not_using_indexes显示全部

检查下数据库参数  log_queries_not_using_indexes 是否是开启状态
SELECT @@long_query_time, @@log_queries_not_using_indexes;

https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_queries_not_using_indexes

收起
金融其它 · 2020-08-27
浏览1493
zhenda 邀答

提问者

zhenda
数据库管理员昆仑银行
擅长领域: 数据库服务器云计算

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2020-08-26
  • 关注会员:2 人
  • 问题浏览:2285
  • 最近回答:2020-08-27
  • X社区推广