经过使用
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) 使用索引规则:字段最短的那个表索引,若是主键字段不是最短的也不会使用主键索引
当然,若是表只有一个主键索引 那肯定就使用主键索引了