oracle 統計資訊過期判斷和自動收集
Stale statistics
Statistics gathered by DBMS_STATS can become out-of-date. Typically, statistics are stale when 10% or more of the rows in the table have changed since the last time statistics were gathered.
The GATHER_DATABASE_STATS or GATHER_SCHEMA_STATS procedures gather new statistics for tables with stale statistics when the OPTIONS parameter is set to GATHER STALE orGATHER AUTO. If a monitored table has been modified more than 10%, then these statistics are considered stale and gathered again.
=======
查詢上次收集表的統計資訊收集時間:
-
Catalog view DBA_OPTSTAT_OPERATIONS contain history of statistics operations performed at schema and database level using DBMS_STATS.
-
The views *_TAB_STATS_HISTORY views (ALL, DBA, or USER) contain a history of table statistics modifications.
==========
oracle預設保留31天的統計資訊:
The database purges old statistics automatically at regular intervals based on the statistics history retention setting and the time of the recent analysis of the system. You can configure retention using the ALTER_STATS_HISTORY_RETENTION procedure of DBMS_STATS. The default value is 31 days, which means that you would be able to restore the optimizer statistics to any time in last 31 days.
DBA_TAB_STATISTICS===>>>
STALE_STATS | VARCHAR2(3) | Indicates whether statistics for the object are stale (YES) or not (NO) |
檢視之前的統計資訊:
select * from DBA_OPTSTAT_OPERATIONS where TARGET like '%DWE_TASKS' order by 3;
select * from dba_TAB_STATS_HISTORY where TABLE_NAME='DWE_TASKS';
select object_id,OBJECT_NAME,LAST_DDL_TIME from DBA_OBJECTS where OBJECT_NAME ='DWE';
select OBJ# ,ROWCNT,BLKCNT,AVGRLN,SAMPLESIZE,ANALYZETIME,SAVTIME from sys.WRI$_OPTSTAT_TAB_HISTORY where obj#=3459727;
select * from table(dbms_stats.diff_table_stats_in_history('TKCSOWNER','DWE',systimestamp,to_timestamp(to_date('26-12-16 10.00.00','dd-mm-yy hh24:mi:ss'))));
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20747382/viewspace-2130822/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 判斷 並 手動收集 統計資訊 指令碼Oracle指令碼
- Oracle統計資訊自動收集Oracle
- 關於oracle自動收集統計資訊Oracle
- 【Oracle】11g Oracle自動收集統計資訊Oracle
- ORACLE 11g 自動收集統計資訊Oracle
- Oracle11g 統計資訊-----統計資訊自動收集任務Oracle
- Oracle11g 統計資訊——統計資訊自動收集任務Oracle
- Oracle 11g 之自動收集統計資訊Oracle
- Oracle10g 統計資訊的自動收集Oracle
- ORACLE10g自動收集CBO統計資訊Oracle
- Oracle的自動統計資訊不收集直方圖的資訊Oracle直方圖
- Oracle 11g無法自動收集統計資訊Oracle
- oracle 11g自動收集統計資訊介紹Oracle
- [統計資訊系列7] Oracle 11g的自動統計資訊收集Oracle
- [zt] Oracle10g 自動收集收集CBO統計資訊設定Oracle
- 開啟oracle10g統計資訊自動收集功能Oracle
- Oracle收集統計資訊Oracle
- Oracle 統計資訊收集Oracle
- 收集oracle統計資訊Oracle
- ORACLE 收集統計資訊Oracle
- 雞肋 -- ORACLE10g自動收集CBO統計資訊(ZT)Oracle
- oracle10g如何啟用禁用自動統計資訊收集Oracle
- Oracle統計資訊的收集和維護Oracle
- 關閉特定物件統計資訊自動收集物件
- 【統計資訊】Oracle常用的收集統計資訊方式Oracle
- Oracle 11g 修改表級別的自動收集統計資訊比率Oracle
- 關閉及開啟oracle10g統計資訊自動收集功能Oracle
- oracle收集統計資訊job停止Oracle
- Oracle 11g系統自動收集統計資訊的一些知識Oracle
- 關閉及開啟oracle10g統計資訊自動收集功能(轉)Oracle
- 關於ORACLE自動統計CBO統計資訊Oracle
- oracle 統計資訊檢視與收集Oracle
- oracle 11g統計資訊收集Oracle
- ORACLE 統計資訊的收集與管理Oracle
- Greenplum自動統計資訊收集-暨統計資訊不準引入的broadcastmotion一例AST
- [Oracle] Oracle收集統計資訊的取樣比例Oracle
- 最佳實踐:解讀GaussDB(DWS) 統計資訊自動收集方案
- Oracle運維指令碼-收集統計資訊Oracle運維指令碼