ITPub博客

首页 > 数据库 > Oracle > Oracle 运维之开发What is different count(*),count(1),count(column)

Oracle 运维之开发What is different count(*),count(1),count(column)

原创 Oracle 作者:lovehewenyu 时间:2013-10-29 15:16:06 0 删除 编辑

What is different count(*),count(1),count(column)

 

总结一下他们,实验过程不记录了,直接结论了。

count(*)

count(1)

count(column)

 

不同点:

count(*)

count(1)

统计包含null值;如果有索引的话,必须保证索引列没有null值才会走索引;

 

count(column)

统计不包含null值;索引列是否有null值都不会影响走索引 ;因为统计的时候就已经把null值排除了;

 

相同点:

count(*)

count(1)

tom说他们是相同的

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:1156159920245

 

 

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26442936/viewspace-775268/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
10年金融行业老鸟。Oracle,Mysql,PostgreSQL,EMC 存储,NBU备份。微信/电话 18211103995

注册时间:2012-02-03

  • 博文量
    307
  • 访问量
    1528553