Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: count(rowid) vs count(*)
Contrary to public believe, count(*) is faster then count(1). If the rows
are being returned via an index, counting the indexed column is still
faster. The optimizer realises from the existence of the index that the
column must also exist (non-null).
From the outstanding book : Oracle performance tuning, Mark Gurry & Peter Corrigan. O'Reilly
Try it out using trace !!!
Rob.
Roger Jackson heeft geschreven in bericht
<7mcemf$pl3$1_at_caley.wire.net.au>...
>Hi,
>
>I was reading an article just recently which stipulated that you should not
>use count(*) to determine the number of rows in a table, but use count(1)
or
>count(ROWID) instead. These options are faster because they bypass some
>unnecessary operations in Oracle's SQL processing mechanism.
>
>Can somebody explain to me why this would be faster and what mechanisms are
>bypassed.
>
>
>TIA
>
>Roger
>
>
Received on Sun Jul 11 1999 - 22:10:50 CDT
![]() |
![]() |