分析oracle索引空间使用情况,以及索引是否须要重建
2016-04-14 10:26
459 查看
分析索引空间使用情况。以及索引是否须要重建
分析其它用户下的索引须要 analyze any的权限
分析索引前先查看表的大小和索引的大小,假设索引大小和表大小一样大或者大于表的大小,那么能够推断索引可能有问题。须要分析索引
查询对象大小:
select owner,segment_name,segment_type,bytes/1024/1024 from dba_segments order by 4 desc
1.分析索引
SQL> analyze index AA.INDEX_AA validate structure;
SQL>
Index analyzed
查询空间使用情况:
SQL> select name, blocks, lf_blks, br_blks, blocks-(lf_blks+br_blks) empty from index_stats;
NAME BLOCKS LF_BLKS BR_BLKS EMPTY
------------------------------ ---------- ---------- ---------- ----------
AA 262144 253480 725 7939
--索引空块达到了7939
2.查询索引删除行和删除比例(一般删除率达到30%就要考虑重建索引)
SQL> select t.name, --索引名
2 t.lf_rows, --number of leaf rows (values in the index)
3 t.lf_blks,
4 t.del_lf_rows, --number of deleted leaf rows in the index
5 (t.del_lf_rows / t.lf_rows)*100 ratio --删除比例
6 from index_stats t
7 where t.name='INDEX_AA';
NAME LF_ROWS LF_BLKS DEL_LF_ROWS RATIO
------------------------------ ---------- ---------- ----------- ----------
AA 77318533 253480 0 0
3.查看索引的使用率以及索引深度(深度>=4时就考虑重建索引)
SQL> SELECT height, NAME, BTREE_SPACE, USED_SPACE, PCT_USED FROM INDEX_STATS;
HEIGHT NAME BTREE_SPACE USED_SPACE PCT_USED
---------- ------------------------------ ----------- ---------- ----------
4 INDEX_AA 2032646380 1231201944 61
--索引深度为4
满足下列条件考虑重建索引
The most common justifications given for rebuilding an index are:
- index becomes fragmented
- index grows and grows - deleted space is not re-used
- index clustering factor becomes out of sync
分析其它用户下的索引须要 analyze any的权限
分析索引前先查看表的大小和索引的大小,假设索引大小和表大小一样大或者大于表的大小,那么能够推断索引可能有问题。须要分析索引
查询对象大小:
select owner,segment_name,segment_type,bytes/1024/1024 from dba_segments order by 4 desc
1.分析索引
SQL> analyze index AA.INDEX_AA validate structure;
SQL>
Index analyzed
查询空间使用情况:
SQL> select name, blocks, lf_blks, br_blks, blocks-(lf_blks+br_blks) empty from index_stats;
NAME BLOCKS LF_BLKS BR_BLKS EMPTY
------------------------------ ---------- ---------- ---------- ----------
AA 262144 253480 725 7939
--索引空块达到了7939
2.查询索引删除行和删除比例(一般删除率达到30%就要考虑重建索引)
SQL> select t.name, --索引名
2 t.lf_rows, --number of leaf rows (values in the index)
3 t.lf_blks,
4 t.del_lf_rows, --number of deleted leaf rows in the index
5 (t.del_lf_rows / t.lf_rows)*100 ratio --删除比例
6 from index_stats t
7 where t.name='INDEX_AA';
NAME LF_ROWS LF_BLKS DEL_LF_ROWS RATIO
------------------------------ ---------- ---------- ----------- ----------
AA 77318533 253480 0 0
3.查看索引的使用率以及索引深度(深度>=4时就考虑重建索引)
SQL> SELECT height, NAME, BTREE_SPACE, USED_SPACE, PCT_USED FROM INDEX_STATS;
HEIGHT NAME BTREE_SPACE USED_SPACE PCT_USED
---------- ------------------------------ ----------- ---------- ----------
4 INDEX_AA 2032646380 1231201944 61
--索引深度为4
满足下列条件考虑重建索引
The most common justifications given for rebuilding an index are:
- index becomes fragmented
- index grows and grows - deleted space is not re-used
- index clustering factor becomes out of sync
相关文章推荐
- (二)IBM Sterling OMS 环境构建之Oracle安装
- 7、其他模式对象
- Oracle 11g r2 使用Data dump 从CentOS 迁移到Window 2012
- 使用yum高速部署Oracle安装环境(11g)
- oracle SQL
- 为什么TimesTen比使用内存缓存的Oracle还要快
- 配置Oracle Client 访问远程Oracle数据库
- oracle判断一个字符串中是否包含另外一个字符串(想要不论顺序或者不相邻的字符)
- oracle存储过程中单引号及字符串拼接处理
- Win64安装cx_Oracle过程
- oracle 监听配置
- 数据分布不均衡导致性能问题
- oracle linux下开放1521端口
- JDBC 链接oracle的三种URL写法
- Oracle_dbms_shared_pool.purge 包的使用
- Oracle_cursor_shared 参数解释
- Oracle_object_id和data_object_id的区别与联系
- Oracle-10-对表中数据进行增删改查
- Oracle-09-删除表(drop和truncate区别、闪回删除等)
- oracle学习 第二章 限制性查询和数据的排序 ——02