您的位置:首页 > 数据库 > MySQL

用tail -f查看mysql慢查询日志

2012-02-04 15:44 351 查看
输入:tail -f /tmp/slowquery.log

-----------------------

我们可以通过tail -f查看日志文件。

$tail -f /var/lib/mysql/slow-queries.log

# Time: 110107 16:22:11

# User@Host: root[root] @ localhost []

# Query_time: 9.869362 Lock_time: 0.000035 Rows_sent: 1 Rows_examined: 6261774

SET timestamp=1294388531;

select count(*) from ep_friends;

第一行,SQL查询执行的时间

第二行,执行SQL查询的连接信息

第三行记录了一些我们比较有用的信息

Query_time SQL执行的时间,越长则越慢

Lock_time 在MySQL服务器阶段(不是在存储引擎阶段)等待表锁时间

Rows_sent 查询返回的行数

Rows_examined 查询检查的行数

---------------------------------------------

来源: http://hi.baidu.com/%CE%F7%BA%FE%B5%C0%B3%A4/blog/item/0bb95056ba0ea044d109069d.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: