Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Finding total Rows without count() ?
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
![]() |
![]() |