> 
> Ari,
> 
> I "stumbled" on your website and found much useful information.  Thanks
> for the time and effort .... the site is great.  I have a question of my own
> that I hope you will be kind enough to answer:
> 
> We run Oracle 7.2.2.4 on HP-UX 10.20.  I queried user_tables logged on
> to SQL*Plus as the user who owned the tables I wanted to look at.  In the
> field num_rows a value was returned that in many cases differed from
> the number of rows I would get by directly querying the specific table
> with the "select count(*) from tablename" query.  Can you explain the
> descrepancy?  My email address is hkaufman@co.new-castle.de.us. 
> Thanks.
> 
Harry,

Thanks for giving the positive feedback on my web page. I do not get money from it, but do it to help ther Oracle community in general.

The reason that you are getting a different number in the NUM_ROWS column in
the USER_TABLES (or ALL_TABLES or DBA_TABLES) views than the actual value
is that NUM_ROWS is updated only when you analyze the table.

For example, if your table has 1000 records and you issue:

ANALYZE TABLE table_name COMPUTE STATISTICS;

The NUM_ROWS column at that point will be 1000.

At this point, if you insert 1000000 records, and do NOT analyze the table
again, you will have 1100000 records, but NUM_ROWS will still be 1000.


-Ari Kaplan
Independent Oracle DBA Consultant

<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
<-> For 105+ Oracle tips, visit my Web Page:                      <->
<->                                                               <->
<->             www.arikaplan.com                                 <->
<->                                                               <->
<->             email: akaplan@interaccess.com                    <->
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->

Back to Ari Kaplan's Home Page ">Back to Ari Kaplan's Home Page