索引的统计信息主要包含索引blevel(索引高度-1)、叶子块的个数(leaf_blocks)以及集群因子(clustering_factor)。我们可以通过数据字典DBA_INDEXES 查看索引的统计信息。

创建索引的时候会自动收集索引的统计信息

create index idx_t_test_id on t_test(t_id);

查看索引的统计信息。

select blevel, leaf_blocks, clustering_factor, status
from dba_indexes
where owner = 'SCOTT'
and index_name = 'IDX_T_TEST_ID';

单独收集索引的统计信息

BEGIN
DBMS_STATS.GATHER_INDEX_STATS(ownname => 'SCOTT',
indname => 'IDX_T_TEST_ID');
END;
/