Home » SQL & PL/SQL » SQL & PL/SQL » get row counts daily (Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production)
get row counts daily [message #650446] Mon, 25 April 2016 10:01 Go to next message
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 #650449 is a reply to message #650446] Mon, 25 April 2016 10:20 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
why not count the rows as they get loaded?
Re: get row counts daily [message #650452 is a reply to message #650449] Mon, 25 April 2016 11:35 Go to previous messageGo to next message
TorontoTrader
Messages: 8
Registered: January 2007
Junior Member
there is jsut too many people involved in too many processes that we want to disconnect thier recovery from this stats collection
Re: get row counts daily [message #650453 is a reply to message #650446] Mon, 25 April 2016 11:37 Go to previous messageGo to next message
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

Re: get row counts daily [message #650454 is a reply to message #650453] Mon, 25 April 2016 11:43 Go to previous message
TorontoTrader
Messages: 8
Registered: January 2007
Junior Member
thanks
Previous Topic: Please help for regexp_replace in oracle 11g
Next Topic: narration in one line
Goto Forum:
  


Current Time: Wed Apr 24 19:05:08 CDT 2024