1.分析表与索引(analyze 不会重建索引)
analyze table tablename compute statistics
等同于 analyze table tablename compute statistics for table for all indexes for all columns
for table 的统计信息存在于视图:user_tables 、all_tables、dba_tables
for all indexes 的统计信息存在于视图: user_indexes 、all_indexes、dba_indexes
for all columns 的统计信息存在于视图:user_tab_columns、all_tab_columns、dba_tab_columns
注:分析表与索引见 AnalyzeAllTable存储过程
2、一般来讲可以采用以下三种方式来手工分析索引。
analyze index idx_t validate structure:
analyze index idx_t compute statistics:
analyze index idx_t estimate statistics sample 10 percent
1)analyze index idx_t validate structure:
这段分析语句是用来分析索引的block中是否有坏块儿,那么根据分析我们可以得到索引的结构数据,这些数据会保留到
index_stats中,来判断这个索引是否需要rebuild. 需要注意的是这样的分析是不会收集索引的统计信息的。
2)validate structure有二种模式: online, offline, 一般来讲默认的方式是off