patternMinor
num_rows in dba_tables not reflecting the real number of rows in tables Oracle 9i
Viewed 0 times
realrowsthenumbertablesreflectingdba_tablesoraclenum_rowsnot
Problem
I'm querying
But I notice that even for some non empty tables,
Could somebody please explain this strange behavior of
dba_tables in order to get a listing of tables and their rowcount with following sql request : select * from dba_tables where owner='dbSID';But I notice that even for some non empty tables,
NUM_ROWS column is returning null values. Could somebody please explain this strange behavior of
dba_tables ?Solution
It's an estimate. See http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2105.htm#i1592091.
If you run the following :
within Oracle SQL*Plus. You'll get then the exact value of row numbers (until subsequent inserts / deletes change the actual row count so it no longer matches the one gathered).
If you need a precise value you'll need to use
If you run the following :
exec dbms_stats.gather_schema_stats('owner');within Oracle SQL*Plus. You'll get then the exact value of row numbers (until subsequent inserts / deletes change the actual row count so it no longer matches the one gathered).
If you need a precise value you'll need to use
SELECT count(*) ...Code Snippets
exec dbms_stats.gather_schema_stats('owner');Context
StackExchange Database Administrators Q#76409, answer score: 3
Revisions (0)
No revisions yet.