INDEX_STATS

这个视图主要是通过执行Analysis Index index_name VALIDATE STRUCTURE语句产生的统计信息,注意这个视图是session级别的。

上述这个语句只是分析相关索引信息,并不会统计收集、更新索引的信息状态等,如若要统计收集、更新索引的状态,必须使用:

Alter Index index_name Compute Statistics;

INDEX_STATS stores information from the last ANALYZE INDEX ... VALIDATE STRUCTURE statement.

Note:

The ANALYZE INDEX ... VALIDATE STRUCTURE OFFLINE statement must be used in order to collect statistics
ColumnDatatypeNULLDescription
HEIGHTNUMBER Height of the B-Tree
BLOCKSNUMBERNOT NULLBlocks allocated to the segment
NAMEVARCHAR2(30)NOT NULLName of the index
PARTITION_NAMEVARCHAR2(30) Name of the partition of the index which was analyzed. If the index is not partitioned, NULL is returned.
LF_ROWSNUMBER Number of leaf rows (values in the index)
LF_BLKSNUMBER Number of leaf blocks in the B-Tree
LF_ROWS_LENNUMBER Sum of the lengths of all the leaf rows
LF_BLK_LENNUMBER Usable space in a leaf block
BR_ROWSNUMBER Number of branch rows in the B-Tree
BR_BLKSNUMBER Number of branch blocks in the B-Tree
BR_ROWS_LENNUMBER Sum of the lengths of all the branch blocks in the B-Tree
BR_BLK_LENNUMBER Usable space in a branch block
DEL_LF_ROWSNUMBER Number of deleted leaf rows in the index
DEL_LF_ROWS_LENNUMBER Total length of all deleted rows in the index
DISTINCT_KEYSNUMBER Number of distinct keys in the index (may include rows that have been deleted)
MOST_REPEATED_KEYNUMBER How many times the most repeated key is repeated (may include rows that have been deleted)
BTREE_SPACENUMBER Total space currently allocated in the B-Tree
USED_SPACENUMBER Total space that is currently being used in the B-Tree
PCT_USEDNUMBER Percent of space allocated in the B-Tree that is being used
ROWS_PER_KEYNUMBER Average number of rows per distinct key (this figure is calculated without consideration of deleted rows)
BLKS_GETS_PER_ACCESSNUMBER Expected number of consistent mode block reads per row, assuming that a randomly chosen row is accessed using the index. Used to calculate the number of consistent reads that will occur during an index scan.
PRE_ROWSNUMBER Number of prefix rows (values in the index)
PRE_ROWS_LENNUMBER Sum of lengths of all prefix rows
OPT_CMPR_COUNTNUMBER Optimal key compression length
OPT_CMPR_PCTSAVENUMBER Corresponding space savings after an ANALYZE


通过该视图我们可以判断一个所以是否需要重建:
对一个索引进行结构分析后,如果该索引占用超过了一个数据块,且满足以下条件之一;
B-tree树的高度大于3;
使用百分比低于75%;
数据删除率大于15%.

SQL> select btree_space, -- if > 8192(块的大小)
height, -- if > 3
pct_used, -- if < 75
del_lf_rows/(decode(lf_rows,0,1,lf_rows)) *100 as deleted_pct -- if > 15%
from index_stats;

-The End-

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值