当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
Oracle认证综合辅导:Oracle创建索引策略
发布时间:2012/9/16 22:15:55 来源:城市网学院 编辑:admin
   学习Oracle时,经常会遇到Oracle索引问题,这里将介绍Oracle索引问题的解决方法。Oracle索引和对应的表应该位于不同的表空间中,Oracle能够并行读取位于不同硬盘上的数据,可以避免产生I/O冲突B树索引:在B树的叶节点中存储索引字段的值与ROWID.唯一索引和不唯一索引都只是针对B树索引而言。Oracle最多允许包含32个字段的复合索引
    Oracle索引创建策略
    1.导入数据后再创建索引
    2.不需要为很小的表创建索引
    3.对于取值范围很小的字段(比如性别字段)应当建立位图索引
    4.限制表中的索引的数目
    5.为索引设置合适的PCTFREE值
    6.存储索引的表空间最好单独设定
    创建不唯一索引
    1. create index emp_ename on employees(ename)
    2. tablespace users
    3. storage(……)
    4. pctfree 0;
    创建唯一索引
    1. create unique index emp_email on employees(email)
    2. tablespace users;
    创建位图索引
    1. create bitmap index emp_sex on employees(sex)
    2. tablespace users;
    创建反序索引
    1. create unique index order_reinx on orders(order_num,order_date)
    2. tablespace users
    3. reverse;
    创建函数索引(函数索引即可以是普通的B树索引,也可以是位图索引)
    1. create index emp_substr_empno
    2. on employees(substr(empno,1,2))
    3. tablespace users;
    以上介绍Oracle索引创建策略。
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved