Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Finding total Rows without count() ?
Don't know if this is an old wives tale or not, but I have always been
under the impression that count(1) was the quickest way to get a row
count from a table. The premise that count(*) reads each row in its
entirety into the sga, whereas count(1) reads one byte into the sga
for each row, greatly reducing the i/o and memory resources for the
counting of the table.
What about select max(rownum) from table? Would that be quicker than
count(1)?
This would definitely need some testing.
regards
~Jim
On Wed, 15 Dec 1999 01:25:40 GMT, Ken Sproule <kenmn_at_tds.net> wrote:
>As always, thanks in advance for your help.
>
>I need a fast way to determine the total number of rows in a table. I
>assume somewhere Oracle stores such information about its tables.
>Where is it?
>
>The count() type syntaxes take much too long on tables of say 3+
>million rows, so I'm looking for a fast way to accomplish it.
>
>Post answers to the group, as others might be interested also.
>
>Thanks,
>
>Ken Sproule
>kenmn_at_tds.net
>
Received on Tue Dec 14 1999 - 20:45:30 CST
![]() |
![]() |