Re: Counting number of rows

  • From: "Jonathan Lewis" <jonathan@xxxxxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 17 Feb 2004 21:33:55 -0000

Mladen,

I tried this on sys.tab$ and it didn't work.
Some problem about a clustered table.

Regards

Jonathan Lewis
http://www.jlcomp.demon.co.uk

  The educated person is not the person 
  who can answer the questions, but the 
  person who can question the answers -- T. Schick Jr


Next public appearances:
 March 2004 Hotsos Symposium - The Burden of Proof
 March 2004 Charlotte NC OUG - CBO Tutorial
 April 2004 Iceland


One-day tutorials:
http://www.jlcomp.demon.co.uk/tutorial.html


Three-day seminar:
see http://www.jlcomp.demon.co.uk/seminar.html
____UK___February
____UK___June


The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html


----- Original Message ----- 
From: "Mladen Gogala" <mladen@xxxxxxxxxxxxxxx>
To: <oracle-l@xxxxxxxxxxxxx>
Sent: Tuesday, February 17, 2004 9:15 PM
Subject: Re: Counting number of rows


The function below would count rows extremely quickly, and is  
independent of the table size. Even better, it is completely accurate
and doesn't rely on the underlying statistics. The table
in question may not even be analyzed. It does have one minor
shortcoming, however.

<PRANK>
create or replace
function count_rows(tbl in varchar2) return number deterministic
as
TRUNC VARCHAR2(128):='truncate table '||tbl;
begin
execute immediate trunc;
return(0);
end;
/
</PRANK>
On 02/17/2004 03:27:31 PM, "Potluri, Venu (CT Appl Suppt)" wrote:
> Is there a quick way to count number of rows in a table? Don't want  
> to
> do select count(*) from..... on a table (such as GL_BALANCES) with
> more than 250 million rows.
> --------------------------------------------------------
> 


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: