在MySQL中记录慢查询 [英] Logging slow queries in MySQL
本文介绍了在MySQL中记录慢查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 my.ini
log_slow_queries = "C:\Program Files (x86)\MySQL\MySQL Server 5.0\mysql-slow.log"
long_query_time = 3
log-queries-not-using-indexes
我重新启动了MySQL服务.慢速查询已在mysql-slow.log
中列出,但问题是所有查询都已列出.我只想列出那些花费3秒钟以上的查询
I restarted the MySQL service . The slow queries are getting listed in mysql-slow.log
but the issue is all the queries gets listed . I want to list only those queries which take more than 3 seconds
以下是mysql-slow.log
的摘录:
# Query_time: 0 Lock_time: 0 Rows_sent: 29 Rows_examined: 29
SHOW TABLES LIKE 'tblRaw2%';
这里Query_time列为0我只想要那些花费3秒钟以上的查询. 如果要在my.ini中设置其他字段,请指出
Here Query_time is listed as 0 I want only those queries which takes more than 3 seconds . If there is any more fields to be set in my.ini please point out
谢谢
推荐答案
您的数据库可能没有indexes
,而您已经定义了该内容:
Your database probably doesn't have indexes
and you've defined that :
log-queries-not-using-indexes
应该被记录.
删除log-queries-not-using-indexes
,然后重试.
这篇关于在MySQL中记录慢查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文