2

I've told MySQL to log queries that take longer than a second (1 in the config)... however I'm seeing queries like this that take much less than a second....

# Time: 101108  6:39:32
# User@Host: source_member[source_member] @ localhost []
# Query_time: 0.007271  Lock_time: 0.000062 Rows_sent: 1  Rows_examined: 2635
SET timestamp=1289216372;
SELECT
                                                id,
                                                name,
                                                email,
                                                auth_key
                                        FROM member
                                        INNER JOIN source_member.group_assoc ON (
                                                source_member.group_assoc.group_id = 121 AND
                                                source_member.group_assoc.member_id = member.id
                                        );

My settings are...

log_slow_queries        = /var/log/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes

I should ask... this means that it's only logging queries that do not have any indexes at all?

Ben
  • 3,800
  • 18
  • 65
  • 96

1 Answers1

1

What is long_query_time set to? log-long-format or log-queries-not-using-indexes active?

The most likely explanation either an incorrect setting of logging.

--log-queries-not-using-indexes and log-long-format both cause queries not using Indexes to be logged. Sometimes not using an index is faster, and this can cause a lot of log spam.

Also note that you might lock on IO somewhere. long_query_time is checked against WALL time not CPU time.

pehrs
  • 8,789
  • 1
  • 30
  • 46
  • I've updated my post with my settings.... I can't find any examples of `log-long-format` on google – Ben Nov 08 '10 at 18:16
  • And here is your explanation: http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_log-queries-not-using-indexes ;) – pehrs Nov 08 '10 at 19:21