MySQL long_query_time 值

标签 mysql debugging optimization logging

我正在调试 MySQL 5.1.61 数据库,我在 my.cnf 文件中将 long_query_time 设置为 10。慢速查询被记录到数据库表。

但是,它记录的查询只需要几分之一秒。

事实上,我的查询被记录的速度非常快,mysql 中的 query_time 字段为每个记录的查询显示“00:00:00”。即使当我让他们登录到文件时,他们显示的查询时间也在“Query_time: 0.004763”范围内

我知道我的配置文件正在被读取,因为我的所有其他更改都已生效。

根据我阅读的所有文档,long_query_time 应该是秒。我还需要做些什么才能使该设置生效吗?

最佳答案

那些查询有索引吗?如果不是,那么这可能就是它们被记录的原因。

Before MySQL 4.1, if you also use --log-long-format when logging slow queries, queries that are not using indexes are logged as well. Starting with MySQL 4.1, logging of queries not using indexes for row lookups is enabled using the --log-queries-not-using-indexes option instead. The --log-long-format is deprecated as of MySQL 4.1, when --log-short-format was introduced, which causes less information to be logged. (The long log format is the default setting since version 4.1.) (>>)

关于MySQL long_query_time 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10644253/

相关文章:

mysql - 使用标识编号系统在数据库之间映射记录

c++ - 在 MacOS 上进行多线程 C++ 调试的好工具?

ruby - 如何用大正则表达式加快扫描大字符串的速度?

java - 针对小文件优化Java的NIO

c - 从循环中删除开关

php - 我需要在 schema.xml 中编写什么才能在 Solr 中的两个或多个字段中进行搜索?

mysql - 使用 laravel 查询生成器在另一个表中使用列值

java - 是否可以在Java进程启动后启用调试而无需调试

mysql - SQL `GROUP BY` 和 `MAX()`

c++ - GDB 找不到调试符号