索引空间使用
来源:互联网 发布:淘宝客服中心组织架构 编辑:程序博客网 时间:2024/05/29 18:14
索引的空间不能像堆表一样重用
例如
create table t (x int,y int ,constraint con_t_pk primary key(x) ) ;
analyze index con_t_pk validate structure;
select t.height,t.lf_blks,t.br_blks,t.btree_space from index_stats t ;
insert into t values(1,1);
insert into t values(2,2);
analyze index con_t_pk validate structure;
select t.height,t.lf_blks,t.br_blks,t.btree_space from index_stats t ;----------获取空间一
begin
for i in 3..99998 loop
insert into t values(i,i);
end loop;
commit;
end;
analyze index con_t_pk validate structure;
select t.height,t.lf_blks,t.br_blks,t.btree_space from index_stats t ;----------获取空间二
delete from t;
analyze index con_t_pk validate structure;
select t.height,t.lf_blks,t.br_blks,t.btree_space from index_stats t ;----------获取空间三
begin
for i in 3..99998 loop
insert into t values(i,i);
end loop;
commit;
end;
analyze index con_t_pk validate structure;
select t.height,t.lf_blks,t.br_blks,t.btree_space from index_stats t ;----------获取空间四
获取空间一~-获取空间四都是一样空间大小
如果不强制释放空间 索引的空间非常难重用(例如放索引键值为1 的空间删除后放2)
alter index con_t_pk coalesce ;
alter index con_t_pk rebuild ;
analyze index con_t_pk validate structure;
select t.height,t.lf_blks,t.br_blks,t.btree_space from index_stats t ;
听说回收空间可以使用这个dbms_space.free_blocks
declare
free_blks number:=0;
begin
dbms_space.free_blocks(segment_owner => user,segment_name => 'T',
segment_type => 'Table',freelist_group_id => 0,free_blks => free_blks);
dbms_output.put_line(free_blks);
end
但是在11G上失败,因为freelist_group_id已经不是用了。
监控索引使用
alter index con_t_pk monitoring usage;select * from v$object_usage;
alter index con_t_pk nomonitoring usage;
关于创建多字段的索引中的字段顺序:
1、优先将出现在where谓语后面出现频率高的字段靠前。
2、优先将字段值出现重复率高的字段放在前面(有助于压缩索引,从而减少IO)
- 索引空间使用
- 表空间的管理、索引、sqldlr使用
- 索引使用空间异常增长一例
- 查所有表的记录数,保留空间,使用空间,索引使用空间,未用空间
- 空间索引
- 空间索引
- 空间索引
- 空间索引
- 空间索引
- 查看数据库空间页。表空间页。索引空间页。索引碎片。日志空间的使用情况。
- 空间索引使用的意义及网格索引和四叉树索引简单介绍
- 使用trucate清整表空间及索引整理问题
- 深入浅出空间索引:为什么需要空间索引
- 深入浅出空间索引:为什么需要空间索引
- 空间数据库之空间索引
- 分析oracle索引空间使用情况,以及索引是否需要重建
- 分析oracle索引空间使用情况,以及索引是否需要重建
- 索引空间重用实验
- Keyboard messages/accelerators handling in MFC dialog based applications
- burns的直线检测去ipp化
- 【绝对原创】Unity开发 NGUI如何使游戏屏幕 自适应
- Android 增加按键
- 动画:UIKitAnimation 简单动画----渐变 、 移动 、翻页、来回翻转
- 索引空间使用
- 将Qt程序打deb安装包
- Const关键字的使用
- oc学习之旅:NSDictionary
- http://cerc.tcs.uj.edu.pl/links/
- 远程通信框架-Hessian
- CentOS 6.4安装Fcitx4.0
- 每日英语
- Hibernate Annotation @mappedBy含义在使用onetoone 时候【外键双向关联】(十三)