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: 16 Dec 1999 15:28:12 GMT
Message-ID: <83b0ec$qb4$1@news.seed.net.tw>

Ken Sproule <kenmn_at_tds.net> wrote in message news:brrd5s8pcpj2mo80gbjtsc2mmf99n7ppcc_at_4ax.com...
> 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.

It no way to eliminate using count().
oracle does not record how many rows a table has when performing DML on it.

dba_tables.num_rows may be an answer, but the value may be not reliable if the statistics data is out-of-date.

In Oracle8i, if you doesn't need the exactly value, you can use sample read:

    select count(*)*100 from table_name sample block (1);

It would read only 1% blocks. Received on Thu Dec 16 1999 - 09:28:12 CST

Original text of this message

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