查看统计信息是否过期

查看统计信息是否过期:
DML 超过了 10% 都会过期
begin
  exec dbms_stats.flush_database_monitoring_info;
end;
/

select owner, table_name name, object_type, stale_stats, last_analyzed
  from dba_tab_statistics
 where owner = 'SCOTT' 
   and table_name in ('TEST')
   and (stale_stats = 'YES' or last_analyzed is null);
STALE_STATS 显示为YES,说明表的统计信息过期了。如果 STALE_STATS 显示为NO,表示表的统计信息没有过期。
posted @ 2020-04-01 13:17  屠魔的少年  阅读(185)  评论(0)    收藏  举报