select case when createDate 是否需要建立索引? select case when createDate...case whencase whenendfrom a这里createDate 是否需要建立索引?(按照道理一般是在where语句后面加上索引 但是这个判断在前面,所以也要加索引的哦) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select count(distinct id), case when......group byhis explain:+----+-------------+-------+--------+---------------------------------------------+---------+---------+------------------------+--------+---------------------------------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+-------+--------+---------------------------------------------+---------+---------+------------------------+--------+---------------------------------+| 1 | SIMPLE | ul | ALL | idx_SessionLog, idx_Id_lastime | NULL | NULL | NULL | 183498 | Using temporary; Using filesort || 1 | SIMPLE | u | eq_ref | PRIMARY | PRIMARY | 4 | .ul.Id | 1 | Using where; Using index |+----+-------------+-------+--------+---------------------------------------------+---------+---------+------------------------+--------+---------------------------------+2 rows in set 如何让 1 | SIMPLE | ul | ALL | idx_SessionLog, idx_Id_lastime | NULL | NULL | NULL | 183498 | Using temporary; Using filesort 这里能走索引 在select 和 from 之间的表达式是不会用到索引的。 (特例是,你的查询返回字段在索引中都已包含时会直接读索引而不去用数据文件)where , group , order (distinct 类似于 group ) 会利用到索引。 java连接mysql出现的问题?~ 紧急求问 momery 表,重启MySQL时如何恢复里面的内容 mysql如何打包进应用程序 mysql的亂碼,問題,在建表中解決,但建表中報的錯,怎麼解決,請高手一解 。。字符串处理。。 mysql在缺省状态下直接输入mysql就可以登录,不用密码,如何才能仅仅使有帐号密码的用户才可以进入?? mysql 表行数据根据某个相同字段合并的的sql语句怎么写 mysql 中如何解决临时表不能重复打开的问题 新人小白求一个SQL 有mysql的备份文件,如何还原数据库? 在已有字符串字段的基础上加唯一标示,该如何啊
....
group byhis explain:
+----+-------------+-------+--------+---------------------------------------------+---------+---------+------------------------+--------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------------------------------------+---------+---------+------------------------+--------+---------------------------------+
| 1 | SIMPLE | ul | ALL | idx_SessionLog, idx_Id_lastime | NULL | NULL | NULL | 183498 | Using temporary; Using filesort |
| 1 | SIMPLE | u | eq_ref | PRIMARY | PRIMARY | 4 | .ul.Id | 1 | Using where; Using index |
+----+-------------+-------+--------+---------------------------------------------+---------+---------+------------------------+--------+---------------------------------+
2 rows in set 如何让
1 | SIMPLE | ul | ALL | idx_SessionLog, idx_Id_lastime | NULL | NULL | NULL | 183498 | Using temporary; Using filesort
这里能走索引