Re: Need a Fast Row Count

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/03/27
Message-ID: <954151354.2453.1.pluto.d4ee154e_at_news.demon.nl>#1/1


Which will have of course NOT have the EXACT row count, sorry!!

Regards,

Sybrand Bakker, Oracle DBA

Yuri McPhedran <esiyuri_at_my-deja.com> wrote in message news:8bnabj$fs3$1_at_nnrp1.deja.com...
>
> > >Is there any other way than "select count(*) from <table>" to return
> > >number of rows in an Oracle table? This takes forever to run (>3
> > >minutes) on a table that has over 3 million rows.
 

> > If you do an "analyze table XXX estimate statistics" every night or
> > even twice a day on the table in question, you could do:
> >
> > select num_rows from user_tables where table_name = 'XXX';
> >
> > That would return the approximate row count as of the last analyze
> > (stored in the Last_Analyzed column in the same dictionary view,
> > User_Tables).
> >
> > Chris
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Christopher Hamilton
> > Oracle DBA -- Sandbox.com
> > chamilton_at_sandbox-inc.com
> > http://www.sandbox.com/
> >
>
> Chris,
>
> I also think that is the best way. Fast and fairly accurate, if the
> statistics are up to date. If you analyze the entire schema it also
> allows you to do "select table_name, num_rows from user_tables" which
> can be really useful.
>
> Before anybody asks, the best way to analyze the current schema is of
> course...
>
> exec DBMS_UTILITY.analyze_schema(user,'ESTIMATE');
>
> --
> Regards
> Yuri McPhedran
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Mar 27 2000 - 00:00:00 CEST

Original text of this message