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: Singer, Phillip (P.W.) <psinger1_at_ford.com>
Date: Tue, 15 Feb 2005 13:00:25 -0500
Message-ID: <A45063A7D336504580F0161CEB7FEBE2045480B1@na1fcm60.dearborn.ford.com>

>
>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-l
Received on Tue Feb 15 2005 - 13:03:32 CST

Original text of this message

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