| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Mailing Lists -> Oracle-L -> Re: is it possible in pl/sql?
Looney, Jason wrote:
> My understanding was in the past count(*) returned a count of all non-null
> rows, where count(1) (or any constant) returned a count of all rows.  I just
> verified this with 10g and this is not the case.  The performance difference
> was to perform a full table scan, instead of counting leaf blocks in a
> primary key index or something like that.  So maybe this was true in 6 or 7?
> 
> 
[...]
For what it's worth, my recollection is the same, except I think it was the other way around -- count('x') (based on unique index) would return only non-nulls, because of the way regular indexes handle nulls, while count(*) (full table scan) would return all rows.
I couldn't quickly reproduce the behavior in 10g either, and didn't bother with an older version.
-- Mark Bole http://www.bincomputing.com -- http://www.freelists.org/webpage/oracle-lReceived on Tue Feb 15 2005 - 12:35:32 CST
|  |  |