get row counts daily [message #650446] |
Mon, 25 April 2016 10:01 |
TorontoTrader
Messages: 8 Registered: January 2007
|
Junior Member |
|
|
We are reloading and recovering data for a large warehouse. i am trying to get some stats on data volumes recoverd daily. since stats collection is not enabled during the recovery stage, i am trying to run some smart scripts.
the plan is as follows
1. create a select count(1) from table name
2. check select * from dba_tab_modifications where timestamp>sysdate-1 and table_owner not in ('SYS','SYSTEM')
3. if the table is modified today, then rerun select count(*) for that table only
is dba_tab_modifications an accurate representation of the changes to the table-data?
|
|
|
|
|
Re: get row counts daily [message #650453 is a reply to message #650446] |
Mon, 25 April 2016 11:37 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Quote:1. create a select count(1) from table name
Why count(1) and not count(*)?
Quote:3. if the table is modified today, then rerun select count(*) for that table only
Why count(*) and not count(1)?
Quote:is dba_tab_modifications an accurate representation of the changes to the table-data?
From the documentation of the view:
Quote:DBA_TAB_MODIFICATIONS describes modifications to all tables in the database that have been modified since the last time statistics were gathered on the tables...
Note:
This view is populated only for tables with the MONITORING attribute. It is intended for statistics collection over a long period of time. For performance reasons, the Oracle Database does not populate this view immediately when the actual modifications occur. Run the FLUSH_DATABASE_MONITORING_INFO procedure in the DBMS_STATS PL/SQL package to populate this view with the latest information. The ANALYZE_ANY system privilege is required to run this procedure.
Does this answer the question?
[Updated on: Mon, 25 April 2016 11:39] Report message to a moderator
|
|
|
|