日期:2014-05-17  浏览次数:20682 次

对同一个表根据不同的条件多次执行count(*),有什么办法加快其速度?
有1000多个,慢得要死

------解决方案--------------------
select count(主键) from table

select count(1) from table

------解决方案--------------------
建立索引,对索引列count()
select count(1) from table

select count(*) from table慢
------解决方案--------------------
select count(索引列) from tablename;

count(1)和count(*)如果没有索引第一列,本质上没有什么区别