我使用索引的MySQL表。Expain“解释”的查询结果在MySQL
我的查询是这样
EXPLAIN SELECT * FROM `logs` WHERE userId =288 AND dateTime BETWEEN '2010-08-01' AND '2010-08-27'
我对现场用户id索引此表的日志, 并解释查询的结果是类似下面。
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE logs ref userId userId 4 const 49560 Using where
的问题是“我的索引是真正有用或没有?” ......提前
感谢
@fastmultiplication
我认为双方本场索引可能会增加加载在mysql上,因为将会有很多条目具有唯一的(userId和dateTime)。 我已经尝试添加两个userId_dateTime索引和结果是
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE logs ref userId_dateTime userId_dateTime 4 const 63455 Using where
我已经进入详细有问题,请检查 – 2010-08-27 07:04:19