Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Difference between count(1) and count(*)
And that is, of course, a rather important point; because Oracle almost invariably recognises a call to 'count the rows in the table' however you disguise it, and does whatever the CBO thinks is the fastest row count.
Even to the extent where you can do
something like the following:
create table t1(col1 number primary key, col2 number not null, col3 number);
insert lots of data.
create bitmap index t1_b3 on t1(col3);
select count(col1) from t1;
and get an execution plan which is:
index fast full scan on t1_b3.
Regards
Jonathan Lewis
http://www.jlcomp.demon.co.uk/faq/ind_faq.html The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/seminar.html Optimising Oracle Seminar - schedule updated May 1st
At last someone who bothered to post explain plans to show that the comparisons were valid tests!
![]() |
![]() |