TA的每日心情 | 开心 2023-8-9 11:05 |
---|
|
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');
|
|