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

Home -> Community -> Usenet -> c.d.o.server -> Re: count(rowid) vs count(*)

Re: count(rowid) vs count(*)

From: robie <rlaarhoven_at_sql-integrator.nl>
Date: Mon, 12 Jul 1999 13:10:50 +1000
Message-ID: <931777987.886209@newsreader2.wirehub.nl>


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

Original text of this message

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