Most likely you have log-queries-not-using-indexes enabled, and this
way, relatively fast queries can make it to the slow log (for example a
full table scan on a table containing only 5 records is fast, but it
won't use indexes). The /*!50100 PARTITIONS*/ is a version specific
statement. If you are on version 5.1 or above, this statement will
execute explain partitions, if you are below 5.0, it will be just
explain (partitioning is available from mysql 5.1).
Peter Boros
> I set long query time to be 2 seconds. So I'd expect only queries
> taking longer than 2 seconds would end up in slow query log.
If you have log_queries_not_using_indexes set, that can happen. Also,
check that you are looking at SHOW GLOBAL VARIABLES, and note that this
variable is both local and global, and changes don't take effect for
threads that are currently connected; only new threads see the change
in the global setting. (You can set use_global_long_query_time=1 to
force it to take effect for all threads.)
> The next part of the output is:
>
> # Tables
> # SHOW TABLE STATUS FROM `db` LIKE 't1'\G
> # SHOW CREATE TABLE `db`.`t1`\G
> # EXPLAIN /*!50100 PARTITIONS*/
> select x from t1 where a <= '3170445458' and b >= '3170445458'\G
>
> What does the "/*!50100 PARTITIONS*/" after EXPLAIN mean?
It is a conditional comment that is ignored on 5.0 and earlier. It
makes the EXPLAIN statement copy-paste ready for all versions of MySQL,
including those that don't support partitions.