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

Home -> Community -> Mailing Lists -> Oracle-L -> DBA_TABLES.NUMROWS not equal Count(*) ... Why?

DBA_TABLES.NUMROWS not equal Count(*) ... Why?

From: Sam Bootsma <sbootsma_at_gbrownc.on.ca>
Date: Thu, 16 Feb 2006 16:12:27 -0500
Message-ID: <CC7ECEDD58772D41A44D87EBED4A77A11D4341@TCCEML02.gbrownc.on.ca>


Dbms_stats tells me there are 2000 rows, but count(*) says there are about 3.2 million. Can anybody explain to me what is going on? Please see below. Thanks.    

SQL> exec dbms_stats.set_table_stats('GENERAL','GUROUTP');  

PL/SQL procedure successfully completed.  

SQL> SQL> declare

  2 lNumRows number;

  3 lNumBlks number;

  4 lAvgRLen number;

  5 begin

  6 dbms_stats.get_table_stats('GENERAL','GUROUTP',numrows=>lNumRows, numblks=>lNumBlks, avgrlen=>lAvgRLen);

  7 dbms_output.put_line('No. of rows: ' || lnumrows);

  8 dbms_output.put_line('No. of blks: ' || lnumblks);

  9 dbms_output.put_line('Avg row length: ' || lavgrlen);

 10 end;

 11 /

No. of rows: 2000

No. of blks: 100

Avg row length: 100  

PL/SQL procedure successfully completed.  

SQL> SQL> select count(*) from general.guroutp;  

  COUNT(*)


   3219298  

1 row selected.    

Sam Bootsma

Oracle DBA

George Brown College

sbootsma_at_gbrownc.on.ca <mailto:sbootsma_at_gbrownc.on.ca>

416-415-5000 x4933  

--

http://www.freelists.org/webpage/oracle-l Received on Thu Feb 16 2006 - 15:12:27 CST

Original text of this message

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