|
mysql> explain select skinName, avg(`largest_critcal_strike`) as val, count(id) as times from lmo_player where 1 and YEARWEEK(lmo_player.creationTime,1) = YEARWEEK(now(),1) group by skinName;
+----+-------------+------------+------+---------------+------+---------+------+---------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+---------------+------+---------+------+---------+----------------------------------------------+
| 1 | SIMPLE | lmo_player | ALL | NULL | NULL | NULL | NULL | 4803138 | Using where; Using temporary; Using filesort |
+----+-------------+------------+------+---------------+------+---------+------+---------+----------------------------------------------+
另外这句改如何优化索引呢?lmo_player.creationTime是日期型,有人说改成字符型,然后 YEARWEEK(date(lmo_player.creationTime))这样会更优,可以走索引,是吗? |
|