Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: is it possible in pl/sql?

Re: is it possible in pl/sql?

From: Mark Bole <makbo_at_pacbell.net>
Date: Tue, 15 Feb 2005 09:47:55 -0800
Message-ID: <421235CB.6000402@pacbell.net>


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

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 15 2005 - 12:50:46 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US