Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: is it possible in pl/sql?
Mark Bole wrote:
> 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? >> >>
Hmmm.. from "Oracle Performance Tuning 2nd edition" (Gurry and Corrigan, O'Reilly Press, 1996) -- so were talking version 7 RBO here:
"Contrary to popular belief, COUNT(*) is faster than COUNT(1). If the rows are being returned via an index, counting the index column--for example, COUNT(EMP_NO) is faster still. [followed with actual test runs including timings to prove this]"
So, for the sake of historical accuracy (and not much else), there is some evidence that a long time ago the count(*) performance issue existed.
-Mark Bole
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Feb 15 2005 - 12:50:46 CST
![]() |
![]() |