如何避免在--log-queries-not-using-indexes
打开时记录此查询?
(查询来源)
EXPLAIN SELECT id,autor,description
FROM (
SELECT @cnt := COUNT(*) + 1,
@lim := 3
FROM testimonale
) vars
STRAIGHT_JOIN
(
SELECT r.*,
@lim := @lim - 1
FROM testimonale r
WHERE (@cnt := @cnt - 1)
AND RAND() < @lim / @cnt
) i;
解释
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system 1
1 PRIMARY <derived3> ALL 3
3 DERIVED r ALL 8 Using where
2 DERIVED Select tables optimized away