运维联盟俱乐部

 找回密码
 立即注册
查看: 282|回复: 0

[日常管理] Why statistics gather is not getting reflected after gathering statistics

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2023-12-14 16:36:26 | 显示全部楼层 |阅读模式
    Why statistics gather is not getting reflected after gathering statistics:
    SQL> select owner,table_name,num_rows,last_analyzed from dba_tables where table_name='TEST';

    SQL> OWNER TABLE_NAME NUM_ROWS LAST_ANAL
    ------------------------------ ------------------------------
            SCOTT   TEST

    SQL> exec DBMS_STATS.GATHER_TABLE_STATS (ownname =>'SCOTT',tabname => 'TEST' , estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE ,cascad
    e => TRUE, method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY' );

    PL/SQL procedure successfully completed.

    SQL> select owner,table_name,num_rows,last_analyzed from dba_tables where table_name='TEST';

    OWNER TABLE_NAME NUM_ROWS LAST_ANAL
    ------------------------------ ------------------------------
        SCOTT   TEST








    CAUSE
    Statistics LAST_ANALYZED was not updated because 'PUBLISH' was set to FALSE.

    select * from dba_tab_stat_prefs where owner = 'SCOTT' and table_name = 'TEST';


    SOLUTION
    SET 'PUBLISH' to TRUE while gathering statistics:

    SQL> Exec dbms_stats.set_table_prefs('SCOTT', 'TEST', 'PUBLISH', 'TRUE');

    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-5-2 14:39 , Processed in 0.058546 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表