# 表的相关统计信息select table_name,num_rows,blocks,last_analyzed from user_tableswhere table_name in ('&table_name');# 索引的相关统计信息select table_name,index_name,blevel,num_rows,leaf_blocks,last_analyzed from user_indexeswhere table_name in ('&table_name');
数据库统计信息的收集
# 收集表统计信息exec dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name',estimate_percent=>10,method_opt=>'for all indexed columns');# 收集索引统计信息exec dbms_stats.gather_index_stats(ownname=>'&owner',indname=>'&index_name',estimate_percent=>'10',degree=>'4');# 收集表和索引统计信息exec dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name',estimate_percent=>10,method_opt=>'for all indexed columns',cascade=>TRUE);# 收集分区表指定分区统计信息exec dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name',partname='&partition_name',estimate_percent=>10,method_opt=>'for all indexed columns',cascade=>TRUE);