count(1),count(*),count(rowid)

下面是三个语句的测试结果,测试表的数据为25341223行(千万级)

SQL> alter system flush shared_pool;

System altered

Executed in 0.047 seconds

SQL> select count(1) from thqlog;

COUNT(1)
----------
25341223

Executed in 12.297 seconds

SQL> alter system flush shared_pool;

System altered

Executed in 0.062 seconds

SQL> select count(*) from thqlog
2 ;

COUNT(*)
----------
25341223

Executed in 12.563 seconds

SQL> alter system flush shared_pool;

System altered

Executed in 0.047 seconds

SQL> select count(rowid) from thqlog;

COUNT(ROWID)
------------
25341223

Executed in 12.172 seconds

从测试结果来看,count(rowid)> count(1) > count(*)


posted @ 2013-05-04 09:48  原想  阅读(426)  评论(0编辑  收藏  举报