Refresh statistics for all tables

 

select 'analyze table '||table_name||' delete statistics; ' from user_tables;

select 'analyze table '||table_name||' compute statistics;' from user_tables;

select 'alter index ' || index_name ||' rebuild tablespace '|| TABLESPACE_NAME ||' compute statistics;' from user_indexes WHERE INDEX_NAME not like 'SYS%';

select 'alter index '||TABLE_OWNER ||'.'||index_name||' compute statistics;' from user_indexes WHERE INDEX_NAME not like 'SYS%';

你可能感兴趣的:(refresh)