Re: is it possible in pl/sql?

  • From: Mark Bole <makbo@xxxxxxxxxxx>
  • Date: Tue, 15 Feb 2005 09:47:55 -0800

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?
>>
>>
> 
> [...]
> 
> For what it's worth, my recollection is the same
> 

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



--
//www.freelists.org/webpage/oracle-l

Other related posts: