
经过使用
1 2 3 4 5 6 7 8 | explain extended select count(*) from user; show warnings; explain extended select count(1) from user; show warnings; explain extended select count(14) from user; show warnings; explain extended select count( id ) from user; show warnings; |
发现他们使用的索引是一样的,测试对比总结:
count(*) count(non-null) 使用索引规则:字段最短的那个表索引,若是主键字段不是最短的也不会使用主键索引
当然,若是表只有一个主键索引 那肯定就使用主键索引了
相关文章:
,请先登录查看所有评论- mysql基础再回顾 2016-12-15
- MySQL错误之‘Got a packet bigger than 'max_allowed_packet' bytes’ 2016-01-13
- Navicat 操作数据库传输 2015-09-29
- Windows7 x86系统下安装MySQL5.5 2015-07-27
- 详解MySQL的操作日志 2015-04-15
网友评论已关闭