`
chunchong
  • 浏览: 37810 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

ORACLE数据索引使用---官方文档理解

阅读更多

http://docs.oracle.com/cd/E05554_01/books/AnyTuning/AnyTuning_DBservers6.html

B-Tree Indexes


Generally speaking, in an online transaction processing environment, a B-tree is most effective when it is highly selective. When this is the case, the index is said to have "high selectivity" because a low percentage of rows in the table have the same index key value.

General Guidelines

With high selectivity in mind, evaluate creating B-tree indexes on columns that:

§     Occur frequently in WHERE clauses//经常出现在where语句当中

§     Often used to join tables (include aggregate tables)//通常用于表的连接操作(包括表的聚合操作)

§     Occur in ORDER BY clauses (the index can facilitate ordering)//经常用来进行排序(该索引通常会被使用)

§     Occur in a foreign key reference constraint//被用来做为外键约束

§     Used to enforce PRIMARY KEY and UNIQUENESS constraints//做为主键或是唯一约束

You can also look at your query workload and identify families of queries that include tight table constraints on tables (point, multi-point, and range queries).

When you have star schemas, both DB2 and Oracle database servers can exploit multi-column B-Tree indexes to accelerate join processing when they are created over the foreign key reference columns of "fact" tables. DB2 and Oracle can also accelerate star join operations when single column indexes are created on the fact table's foreign key reference columns. In the Oracle case, these indexes are specialized Bitmap indexes which are used by the server's star transformation algorithm. See Bitmap Indexes.

Where B-Trees Should Not Be Created

Several situations are worth noting where you should not create B-Tree indexes on columns. These cases include columns which:

§     Have only a few distinct values in their domains. For example, a Type column that has only four distinct values (A, B, C, and D). The index would be said to have "low selectivity." If you have an Oracle database, then these columns of low selectivity are ideal candidates for Bitmap indexes.// 只有几个不同的值供选择。例如,一个“类型”列中四个不同的值ABCD该索引是一个低效的选择。如果你有一个Oracle数据库,那么为这些选择范围小的的列建立位图索引是更好的选择。

§     Occur in WHERE clauses but within functions other than MIN or MAX.//当在where 条件中使用了除了MINMAX以外的函数。

Indexes in these cases waste space and slow down the load process.

Siebel Recommended Methodology

You can follow the methodology described in the following example procedure to create new indexes to speed up a slow running report. The slow running report used in this example is "Abandoned Carts Detail."

http://docs.oracle.com/cd/E05554_01/books/AnyTuning/AnyTuning_DBservers7.html#wp132447

Bitmap Indexes


Oracle supports bitmap indexes which are often useful in many situations where B-tree indexes are not optimal. Namely, for columns which have a large number of duplicate values. For example, a Size column that contains only five distinct values (tiny, small, medium, large, grand).

Oracle's "star transformation algorithm" uses bitmap indexes to join a fact table to its dimensions when they exist on the foreign key constraint columns in a fact table. Actually, this algorithm is robust enough to use a combination of bitmap and B-tree indexes. IBM DB2 takes advantage of this technology in selected situations by dynamically building bitmaps from a single-column B-tree to join tables. Unlike Oracle, however, these are highly specialized cases.

Entries in a bitmap index consist of a search key value and a bitmap which describes rows that contain the search key value. Each bit in the map corresponds with a row in the table, and a bit on signals a row that contains the value in the search key. key value.

Candidates for Bitmap Indexes

Bitmap indexes are most advantageous whenever the cardinality of the index is less than one percent, or lowly-selective. This criterion is nearly the opposite of the guideline for B-Tree indexes.

Look for cases where:

§     A query constrains multiple columns which have few distinct values in their domains (large number of duplicate values).// 一个查询条件包含多个列,并且要创建索引的列只有几个不同的(拥有大量重复值

§     A large number of rows satisfy the constraints on these columns.//大量的数据符合这些列上的约束条件。

§     Bitmap indexes have been created on some or all of these columns. //位图索引可以创建在一个、多个或全部列上。

§     The referenced table contains a large number of rows. //被引用的表包含了非常多的行。

Given this kind of scenario, the server can evaluate the constraints by ANDing the bitmaps and potentially eliminate a large number of rows without ever accessing a row in the table.

The Oracle database server can also generate query execution plans to join a fact table to its dimensions using its star transformation algorithm when bitmap indexes exist on the fact table foreign key reference columns. When this execution plan is the least costly, the server joins the tables using the bitmap indexes.

CAUTION: Bitmap indexes should be used only for static tables and are not suited for highly volatile tables in online transaction processing systems.//位图索引只能用在相对稳定的表,不适合用在表数据频繁变化的联机系统中。

Also, the Oracle optimizer generates query plans only when the cost-based optimizer has been enabled.

To create a bitmap index, use the "bitmap" keyword:

create bitmap index w_srvreq_d_m2 on w_srvreq(area_I)
nologging tablespace idx pctfree 0 ;

You can analyze a bitmap index just like you do any other index:

analyze index w_srvreq_d_m2 compute statistics ;

分享到:
评论

相关推荐

    Oracle 11R2 官方文档(中英对照版,PDF)

    Oracle 11R2 文档中准确描述了Oracle的体系结构,索引,数据完整性,有时间给大家上传一下我自己理解的Oracle索引

    Oracle SQL高级编程(资深Oracle专家力作,OakTable团队推荐)--随书源代码

    有近20年使用Oracle技术产品以及Oracle数据库管理员/Oracle数据库应用管理员的经验,是真正应用集群、性能调优以及数据库内部属性方面的专家。同时是一位演讲家及Oracle ACE。  JARED STILL 从1994年就开始使用...

    ORACLE9i_优化设计与系统调整

    §1.1.1 Oracle数据字典 23 §1.1.2 表空间与数据文件 24 §1.1.3 Oracle实例(Instance) 24 §1.2 Oracle文件 26 §1.2.1 数据文件 26 §1.2.2 控制文件 26 §1.2.3 重做日志文件 26 §1.2.4 其它支持文件 26 §...

    Oracle9i数据库系统概述.pdf

    4 第二节:Oracle9i数据库体系结构 Oracle9i数据库的体系结构可以从以下四个 方面来理解: 物理存储结构 逻辑存储结构 内存结构 进程结构 5 一、物理存储结构 从数据的物理存储结构来看, Oracle9i数 据库由三类...

    Oracle数据库管理员技术指南

    2.4.5 怎样从数据字典中提取索引定义 2.5 回顾 第3章 导出和导入技术 3.1 导出/导入特性概述 3.1.1 使用导出和导入 3.1.2 导出/导入的一般使用 3.1.3 导出方式 3.1.4 导入方式 3.1.5 创建必需的数据字典视图...

    H155-合集-大型数据库系统概论-实验.pptx

    使用Oracle企业管理器或手工方法创建一个索引簇、哈希簇,并在新建簇上创建新表。 6. 使用Oracle企业管理器或手工方法创建一个过程、函数和包。 H155-合集-大型数据库系统概论-实验全文共24页,当前为第12页。 大型...

    数据库系统-招标参数---模板.doc

    增强系统" " " "的并发管理 " " " "支持在同一个硬件服务器上运行多个数据库实例 " " " "支持同一个实例上运行多个数据库,同一管理控制" " " "台完成所有管理工作,工具易于理解、使用同一产" " " "品中具有完整的...

    TianleSoftware Oracle中文学习手册

    在Oracle 几年的学习中,做了很多的实验,也遇到了很多的问题, 在这个过程中,积累了一些学习文档。也更新到了blog上。 因为太多,不便于查阅。 根据自己对 Oracle 的理解,把这些 blog 进行了分类,并进行了一些...

    数据库设计规范(1).doc

    物理数据模型:在逻辑数据模型基础上,根据DBMS特点和处理的需要,进行物理存 储安排,设计索引,形成数据库内模式。可以用Sybase PowerDesigner工具直接建立物理数据模型(PDM),或者通过CDM / LDM转换得到。 ...

    asp.net知识库

    使用.ashx文件处理IHttpHandler实现发送文本及二进制数据的方法 制作一个简单的多页Tab功能 一完美的关于请求的目录不存在而需要url重写的解决方案! 在C#中实现MSN消息框的功能 XmlHttp实现无刷新三联动ListBox 鼠标...

    Spring-Reference_zh_CN(Spring中文参考手册)

    7.9.2. 使用元数据驱动的自动代理 7.10. 使用TargetSources 7.10.1. 热交换目标源 7.10.2. 池化目标源 7.10.3. 原型目标源 7.10.4. ThreadLocal目标源 7.11. 定义新的通知类型 7.12. 更多资源 8. 测试 8.1. 简介 8.2...

    数据库系统实验报告.pdf

    实验一 SQL语言 一、实验目的 (1)通过上机实践,熟悉Oracle的SQL * Plus环境及使用方法 (2)掌握SQL语言,能熟练运用SQL语言进行数据定义和数据操纵 (3)加深对关系数据模型的数据结构和约束的理解 二、实验环境 硬件...

    二、大数据与分布式.pdf

    三、数据组织与管理 ⼤数据组织和管理技术主要包括数据划分技术、数据块分布技术、索引技术、副本管理技术和⽀持事务处理技术等,下⾯重点介绍⼀下前三 种技术,后两种技术将在后续的⽂章中详细讨论。 3.1 数据划分...

    JAVA上百实例源码以及开源项目源代码

    2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...

Global site tag (gtag.js) - Google Analytics