Mysql 慢速查询日志是在日志文件中记录更快的查询

Mysql 慢速查询日志是在日志文件中记录更快的查询,mysql,Mysql,我在数据库服务器上设置了MySQL慢速查询日志,并将长查询时间设置为5刚刚检查了日志及其只需毫秒的日志查询。有人知道为什么会这样吗?这是一些日志 I am using mysql sloq query log and set the following line in my.cnf file: slow_query_log=1 long_query_time=5 log-output=FILE log-queries-not-using-indexes but my log file show

我在数据库服务器上设置了MySQL慢速查询日志,并将长查询时间设置为5
刚刚检查了日志及其只需毫秒的日志查询。有人知道为什么会这样吗?这是一些日志

I am using mysql sloq query log and set the following line in my.cnf file:
slow_query_log=1
long_query_time=5
log-output=FILE
log-queries-not-using-indexes

but my log file show like :

# User@Host: root[root] @ localhost []
# Query_time: 0.077108  Lock_time: 0.000042 Rows_sent: 0  Rows_examined: 292
SET timestamp=1389868398;
UPDATE `cp_sessions` SET `last_activity` = 1389868398 WHERE session_id = 'e9f397b37812e7e5b0563de6a32d181b';
# User@Host: root[root] @ localhost []
# Query_time: 0.022188  Lock_time: 0.000072 Rows_sent: 0  Rows_examined: 292
SET timestamp=1389868398;
UPDATE `cp_sessions` SET `last_activity` = 1389868398, `user_id` = NULL, `user_data` = 'a:3:{s:9:\"game_name\";s:5:\"poker\";s:3:\"utm\";N;s:5:\"url_1\";s:23:\"http://adda52merge.org/\";}' WHERE `session_id` = 'e9f397b37812e7e5b0563de6a32d181b';
# User@Host: root[root] @ localhost []
# Query_time: 0.000465  Lock_time: 0.000068 Rows_sent: 1  Rows_examined: 292
SET timestamp=1389868398;
SELECT *
FROM (`cp_sessions`)
WHERE `session_id` = '8c34926f9f6d711bdc14eeeb40b7db7b'
AND `ip_address` = '192.168.1.235'
AND `user_agent` = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko';
# User@Host: root[root] @ localhost []
# Query_time: 0.033085  Lock_time: 0.000036 Rows_sent: 0  Rows_examined: 292
SET timestamp=1389868398;
UPDATE `cp_sessions` SET `last_activity` = 1389868398 WHERE session_id = '8c34926f9f6d711bdc14eeeb40b7db7b';
# User@Host: root[root] @ localhost []
# Query_time: 0.000350  Lock_time: 0.000055 Rows_sent: 1  Rows_examined: 292
SET timestamp=1389868398;
SELECT *
FROM (`cp_sessions`)
WHERE `session_id` = '8c34926f9f6d711bdc14eeeb40b7db7b';
# User@Host: root[root] @ localhost []
# Query_time: 0.031274  Lock_time: 0.000043 Rows_sent: 0  Rows_examined: 292
SET timestamp=1389868398;
UPDATE `cp_sessions` SET `login_attempt` = 0 WHERE `session_id` = '8c34926f9f6d711bdc14eeeb40b7db7b';
# User@Host: root[root] @ localhost []
# Query_time: 0.000298  Lock_time: 0.000029 Rows_sent: 1  Rows_examined: 292
SET timestamp=1389868398;
SELECT *
FROM (`cp_sessions`)
WHERE `user_id` = '113';
# User@Host: root[root] @ localhost []
# Query_time: 0.000479  Lock_time: 0.000080 Rows_sent: 1  Rows_examined: 292
SET timestamp=1389868398;
SELECT *
FROM (`cp_sessions`)
WHERE `session_id` = '4809d7eef185f2bf3d8e38e1858a637c'
AND `ip_address` = '192.168.1.235'
AND `user_agent` = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko';
# User@Host: root[root] @ localhost []
# Query_time: 0.022236  Lock_time: 0.000037 Rows_sent: 0  Rows_examined: 292
SET timestamp=1389868398;
UPDATE `cp_sessions` SET `user_data` = '', `user_id` = 0 WHERE `user_id` = '113';
请帮助我哪里错了,我能为这个缓慢的查询日志做些什么
我想执行需要更多时间执行的查询。

设置
不使用索引的日志查询将向慢速日志添加任何不使用索引的查询

这应该被激活,因为它可以很容易地帮助您优化查询

如果您希望查询超过一定的秒数,则可以执行

从mysql.slow\u日志中选择*,其中query\u time>5


这将给出执行时间超过5秒的查询。

此查询放在哪里?我想检查哪个查询对于多用户登录执行缓慢。那么我如何检查..?在
WHERE
子句中使用
IN
。像
WHERE user_host IN('root[root]@localhost[]”,“other usename etc')
您想要什么extacly,因为您在问题中没有提到任何关于某些用户的信息。实际上,我想检查日志文件中哪个查询速度慢。当我不使用“日志查询不使用索引”时,我的日志不会被创建。但是当我在my.cnf文件中使用上面的语句“LogQueriesNotUsingIndexes”时,我的日志显示了上面的结果。我使用JMeter负载测试登录多用户。这就是我检查日志文件的原因