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

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

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

From: Bobak, Mark <Mark.Bobak_at_il.proquest.com>
Date: Thu, 16 Feb 2006 16:44:01 -0500
Message-ID: <AA29A27627F842409E1D18FB19CDCF2706DE880E@AABO-EXCHANGE02.bos.il.pqe>


Well, what stats are you setting?  

I think you want to use dbms_stats.gather_table_stats rather than set_table_stats which will arbitrarily set them to whatever is saved.  

-- 
Mark J. Bobak 
Senior Oracle Architect 
ProQuest Information & Learning 

"Exception:  Some dividends may be reported as qualified dividends but
are not qualified dividends.  These include: 

* Dividends you received on any share of stock that you held for less
than 61 days during the 121-day period that began 60 days before the
ex-dividend date.  The ex-dividend date is the first date following the
declaration of a dividend on which the purchaser of a stock is not
entitled to receive the next dividend payment. When counting the number
of days you held the stock, include the day you disposed of the stock
but not the day you acquired it. See the examples below. Also, when
counting the number of days you held the stock, you cannot count certain
days during which your risk of loss was diminished.  See Pub. 550 for
more details."

  --IRS, Form 1040-A Instruction Booklet, Line 9b:  Qualified Dividends 

 

________________________________

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sam Bootsma
Sent: Thursday, February 16, 2006 4:12 PM
To: oracle-l_at_freelists.org
Subject: DBA_TABLES.NUMROWS not equal Count(*) ... Why?



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:44:01 CST

Original text of this message

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