Oracle中检查是否需要重构索引的sql

发布时间:2022-04-20 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Oracle中检查是否需要重构索引的sql脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
复制代码 代码如下:

SELECT
height, /*Height of the B-tree*/
blocks, /* Blocks in the index segment */
name, /*index name */
lf_rows, /* number of leaf rows in the index */
lf_blks, /* number of leaf blocks in the index */
del_lf_rows, /* number of deleted leaf rows in the index */
rows_PEr_key /* average number of rows per distinct key */
blk_gets_per_access /* consistent mode block reads (gets) */
From INDEX_statS
WHERE NAME='INDEX_NAME';

复制代码 代码如下:
@H_512_23@
ANALYZE index INDEX_NAME VALIDATE STRUCTURE


HEIGHT:
This column refers to the height of the B-tree index, and IT's usually at the 1, 2, or 3 level.
If large inserts push the index height beyond a level of 4, it's time to rebuild, which flattens the B-tree.

DEL_LF_ROWS:
This is the number of leaf nodes deleted due to the deletion of rows.
oracle doesn't rebuild indexes automatically and, consequently, too many deleted leaf rows can lead to an unbalanced B-tree.

BLK_GETS_PER_ACCESS:
You can look at the BLK_GETS_PER_ACCESS column to see how much LOGical I/O it takes to retrieve data from the index. If this row shows a double-digit number, you should PRobably start rebuilding the index.

脚本宝典总结

以上是脚本宝典为你收集整理的Oracle中检查是否需要重构索引的sql全部内容,希望文章能够帮你解决Oracle中检查是否需要重构索引的sql所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: