Oracle中检查是否需要重构索引的sql
程序员文章站
2023-11-25 16:37:28
复制代码 代码如下: select height, /*height of the b-tree*/ blocks, /* blocks in the index segm...
复制代码 代码如下:
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';
复制代码 代码如下:
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.
推荐阅读
-
SQL Server中检查字段的值是否为数字的方法
-
Oracle中检查是否需要重构索引的sql
-
查看Oracle中是否有锁表的sql
-
SQL Server中检查字段的值是否为数字的方法
-
Oracle中检查外键是否有索引的SQL脚本分享
-
查看Oracle中是否有锁表的sql
-
Oracle中检查是否需要重构索引的sql
-
SQL Server中是否可以准确获取最后一次索引重建的时间?
-
PHP array_key_exists检查键名或索引是否存在于数组中的实现方法,arraykeyexists_PHP教程
-
PHP array_key_exists检查键名或索引是否存在于数组中的实现方法,arraykeyexists