When I do a count of all the rows in a table we have called production.dbug it tell me 1051
When I select all_tables.num_rows where table name = production.dbug it returns 937807
Why the huge difference?
It seems as if all_tables may be storing a high water mark?
Is this bad? The table is cleared every now and then( delete * ) should I do a truncate at that time?
05-23-2001, 01:12 PM
Truncate is a good way to reset the HWM. This is only possible if you are deleting all rows. Remember truncate is a DDL and cannot be rolled back.
05-23-2001, 02:16 PM
is that what num_rows in all_tables is, a high water mark?
05-23-2001, 03:15 PM
05-23-2001, 04:31 PM
Count * actually counts the indexes whereas select all will count each row on the table.
05-23-2001, 04:42 PM
DBA_TABLES reflects the row counts as of the last time the table was analyzed. Issuing a select count(*) from tabxyz will give you the exact number of rows in the table. For example:
SQL> create table xyz (x char(10), y char(10), z char(10));