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