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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding total Rows without count() ?

Re: Finding total Rows without count() ?

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 18 Dec 1999 15:54:44 GMT
Message-ID: <83gao4$nk6$1@news.seed.net.tw>

Alan Shein <alanshein_at_erols.com> wrote in message news:83b6cg$h0d$1_at_bob.news.rcn.net...
> I've long suspected that
>
> select count(*) from t;
>
> is the same (in terms of process as well as result) as
>
> select max(rownum) from t;
>
> Is this correct?

The result values are the same, but the processes are different.

To perform max(rownum), some addition overhead is needed instinctively: generates a number for each row, compares them, and finds the max values.

Try to use explain plan, you will see Oracle uses different plans. If you review v$sqlarea, you will find that Oracle must use more memory to perform max(rownum) than count(*). Received on Sat Dec 18 1999 - 09:54:44 CST

Original text of this message

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