Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Counting number of rows
Jaromir Nemec looks like Czech name.
Still working on the midnight?
JP
jaromir nemec wrote:
> Hi,
>
>
>
> there is possibility of tuning this count function! Use simple truncate with
> REUSE STORAGE!
>
> Some extent processing will be omitted.
>
>
>
> D.B.Nemec
>
>
>
> PS: to restore the table is insert /*+ append */ the optimal solution!
>
> ----- Original Message -----
> From: "Mladen Gogala" <mladen_at_wangtrading.com>
> To: <oracle-l_at_freelists.org>
> Sent: Tuesday, February 17, 2004 10: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
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Tue Feb 17 2004 - 17:01:41 CST
![]() |
![]() |