<quote>
count(*) is not the same as count(1)
</quote>
count(*) is the correct way to write it and count(1) is OPTIMIZED TO BE count(*) internally -- since
a) count the rows where 1 is not null is less efficient than
b) count the rows
<quote>
count(*) uses dba_tab_columns....
</quote>
no, nothing uses that. queries are parsed -- this is not "*" like select *, count(*) says COUNT ROWS, period. count(1) says count rows where 1 is not null.
count(*) is the ONLY thing to consider using.
if count(1) were infinitely more efficient, or even a tiny bit -- someone would be able to give you an example.
But they won't because none exist.
select count(*) from t; should use a primary key index (or an index on any column that is not nullable) -- it won't even touch the table in most cases.
count(*) -- it is it.
</code>
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1156151916789 <code>
I don't care how many or what type of columns are in this table, count(*) is it.