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: Finding total Rows without count() ?

Re: Finding total Rows without count() ?

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: Wed, 15 Dec 1999 16:52:16 GMT
Message-ID: <3857C76E.44377D17@rationalconcepts.com>


In looking at your output, why are the different count queries returning different amounts?

It looks like your are comparing apples to oranges because you didn't get the same answer for each query so speed becomes moot?

cindy

bpolarsk wrote:

> Hello
>
> Here are some test run on a Sun 3500 :
>
> 09:35:40 SQL> select count(*) from parameter ;
>
> COUNT(*)
> ----------
> 5767134
>
> Elapsed: 00:00:16.37
>
> SQL> select count(1) from parameter ;
>
> COUNT(1)
> ----------
> 5767286
>
> Elapsed: 00:00:17.77
> SQL> select count(rownum) from parameter ;
>
> COUNT(ROWNUM)
> -------------
> 5767323
>
> Elapsed: 00:00:33.37
> SQL> select max(rownum) from parameter ;
>
> MAX(ROWNUM)
> -----------
> 5767607
>
> Elapsed: 00:00:34.26
> SQL> select count(rowid) from parameter ;
>
> COUNT(ROWID)
> ------------
> 5767539
>
> Elapsed: 00:00:21.09
>
> SQL> analyze table parameter estimate statistics ;
>
> Table analyzed.
>
> Elapsed: 00:00:10.27
>
> So the quickest way seems to be the analyze table,
> Shortly followed by select(1).
>
> B. Polarski
> www.geocities.com/bpolarsk
> bpolarsk_at_yahoo.com
> Elapsed: 00:00:21.09
>
> SQL> select max(rownum) from parameter ;
>
> MAX(ROWNUM)
> -----------
> 5767607
>
> Elapsed: 00:00:34.26
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
Received on Wed Dec 15 1999 - 10:52:16 CST

Original text of this message

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