当前位置: 代码迷 >> Oracle管理 >> 对同一个表根据不同的条件多次执行count(*),有什么办法加快其速度?解决方案
  详细解决方案

对同一个表根据不同的条件多次执行count(*),有什么办法加快其速度?解决方案

热度:115   发布时间:2016-04-24 06:14:58.0
对同一个表根据不同的条件多次执行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(*)如果没有索引第一列,本质上没有什么区别
  相关解决方案