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

Home -> Community -> Usenet -> c.d.o.server -> Re: Record row count and execution time into table?

Re: Record row count and execution time into table?

From: www.twisted-nail.com <primoz.mihelic_at_email.si>
Date: 1 Oct 2005 01:34:12 -0700
Message-ID: <1128155652.631970.6810@f14g2000cwb.googlegroups.com>


Hi,

Counting the rows in the table is performed by full table scan. For large tables you can query v$session_longops. You can use the following query:

SELECT l.sofar,l.totalwork, l.units, l.message, l.time_remaining, l.elapsed_seconds
  FROM v$session_longops l,

       v$session s

 WHERE l.SID = s.SID
   AND s.sql_hash_value=l.sql_hash_value
   AND l.sofar <> l.totalwork
   AND s.SID = <type your sid>

You can get table name from v$session_longops.target and number of seconds from v$session_longops.elapsed_seconds.

Best regards,
Primoz Mihelic

Matthias Hoys je napisal:
> "Snewber" <snew_at_snew.com> wrote in message
> news:dhi2u8$2g5p$1_at_bunyip2.cc.uq.edu.au...
> >I was wondering if anyone knows the best way to count the number of rows in
> >a table and enter this row count into a table along with how long the query
> >took to execute?
> >
> > I realise that you can get both the row count and SQL execution time by
> > turning timing on and then running the select count(*) ... but then I have
> > to format the results and then do the insert into a table.
> >
> > Is there an easier way?
>
> Strange question ... why do you need this ? The time a COUNT(*) takes can
> highly depend on factors as available disk i/o, indexes, buffer cache etc.
> I really see no use for it ?
>
> Matthias
Received on Sat Oct 01 2005 - 03:34:12 CDT

Original text of this message

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