免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5982 | 回复: 2
打印 上一主题 下一主题

状态为unusable的索引影响DML速度吗? [复制链接]

论坛徽章:
0
1 [报告]
发表于 2008-07-16 22:27 |显示全部楼层
如果确定unusable不影响DML速度的话,我想把3个过程优化下,改成下面方式.
1.set index为unusable
2.insert大量数据
3.rebuild索引
因rebuild比create要快,不用排序。
各位大虾,我的想法可以吗? 谢谢!
这个应该更快,因为Rebuild肯定比create快

论坛徽章:
0
2 [报告]
发表于 2008-07-17 17:54 |显示全部楼层
10g中吧index 设置成为unusable可以插入的,9I没有试过

论坛徽章:
0
3 [报告]
发表于 2008-07-19 14:04 |显示全部楼层
SQL> drop table test_part1;

Table dropped

SQL>
SQL> create table test_part1 (id number(4),hire_date date)
  2  partition by range (id)
  3  (
  4  partition testpart1_1 values less than (100) tablespace part1,
  5  partition testpart1_2 values less than (200) tablespace part2,
  6  partition testpart1_3 values less than (300) tablespace part3,
  7  partition testpart1_4 values less than (maxvalue)
  8  );

Table created

SQL>
SQL> declare
  2  i int;
  3  begin
  4  for i in 1..600 loop
  5  insert into test_part1 values (i,sysdate);
  6  end loop;
  7  end;
  8  /

PL/SQL procedure successfully completed

SQL> create index test_part1_indx on test_part1(id)
  2  /

Index created

SQL> alter index test_part1_indx unusable;

Index altered

SQL>
SQL> declare
  2  i int;
  3  begin
  4  for i in 1..600 loop
  5  insert into test_part1 values (i,sysdate);
  6  end loop;
  7  end;
  8  /

PL/SQL procedure successfully completed

SQL> commit;

Commit complete
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP