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:
>
>
>Hmmm.. from "Oracle Performance Tuning 2nd edition" (Gurry and=20
>Corrigan,=20
>O'Reilly Press, 1996) -- so were talking version 7 RBO here:
>
>"Contrary to popular belief, COUNT(*) is faster than COUNT(1). If the=20
>rows are being returned via an index, counting the index column--for=20
>example, COUNT(EMP_NO) is faster still. [followed with actual=20
>test runs=20
>including timings to prove this]"
>
>So, for the sake of historical accuracy (and not much else), there is=20
>some evidence that a long time ago the count(*) performance=20
>issue existed.
>
>-Mark Bole
>
What is interesting is that it is contrasted with a select count() against a column on which a unique index exists - which is shown to be quicker still. Which suggests that (at that time at least) the optimizer was not smart enough to find and use a unique index without lots of help.
I also remember about that time finding advice on Metalink to do a count(*) on a table if one was getting ORA-01555's due to delayed block cleanout - this was supposed to be the 'best' way to force every block to be read.
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Feb 15 2005 - 13:03:32 CST
![]() |
![]() |