`
chunchong
  • 浏览: 38357 次
  • 性别: 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官方文档合集-SQL参考手册

    Oracle官方文档合集中的SQL参考手册是一份极其重要的资源,对于任何希望深入理解和熟练使用Oracle数据库系统的人员来说,都是不可或缺的工具。这份手册详细阐述了Oracle SQL语言的各个方面,包括其语法、功能以及...

    ORACLE9i官方培训文档----数据库管理基础 II

    《ORACLE9i官方培训文档——数据库管理基础 II》是一份深入学习Oracle 9i数据库管理系统的重要资料,适合对数据库管理有一定基础或者想要提升这方面技能的读者。文档分为英文版和中文版,对于英语不太熟练的读者,...

    Oracle---文档总汇

    Oracle数据库是全球广泛使用的大型关系型数据库管理系统,其在企业级数据存储和管理中扮演着重要角色。"Oracle---文档总汇"集合了一系列与Oracle数据库相关的学习资料,旨在帮助用户全面理解和掌握Oracle数据库的...

    Oracle SQL 官方文档

    学习这些官方文档可以帮助开发者深入理解Oracle SQL的全貌,有效编写高效的查询,设计和实施复杂的数据库解决方案。无论是初学者还是经验丰富的DBA,这些资料都能提供宝贵的指导和参考。在实践中,掌握PL/SQL的编程...

    oracle最全面官方文档

    Oracle数据库是全球广泛使用的大型关系型数据库管理系统,其官方文档为开发者、管理员和技术人员提供了详尽的指导和支持。本资源包含Oracle10g、11g以及9i的官方文档中文版,对于深入理解Oracle数据库的特性和操作...

    oracle官方文档-Oracle Database Concepts

    《Oracle Database Concepts》是Oracle公司发布的官方文档,它详尽地介绍了Oracle数据库的核心概念、架构以及操作原理。这篇文档对于想要深入理解Oracle数据库的人来说,无疑是一份宝贵的资源。以下将根据文档内容,...

    Oracle数据库--索引讲义.pptx

    在Oracle数据库中,索引...通过深入理解和合理使用这些索引概念,数据库管理员和开发人员能够优化Oracle数据库的性能,提高数据查询效率,同时兼顾数据维护的效率。正确应用索引策略对于大型数据库的高效运行至关重要。

    oracle官方文档-Oracle Database Beginner's Guide

    《Oracle Database Beginner's Guide》是Oracle公司为初学者提供的官方指南,旨在帮助读者理解Oracle数据库的基础概念、架构和操作。这份文档深入浅出地介绍了Oracle数据库的核心知识,是Oracle数据库学习者的宝贵...

    Oracle官方文档CHM合集-Oracle10g错误代码

    Oracle 10g 错误代码官方文档是数据库管理员、开发人员和IT专业人士的重要参考...在实际工作中,结合Oracle的其他官方文档,如SQL参考、PL/SQL编程指南和体系结构概述,可以更全面地理解和掌握Oracle 10g数据库系统。

    Oracle官方文档中文版-SQLPlus入门

    通过这个官方文档,无论是初学者还是经验丰富的DBA,都能深化对SQLPlus的理解,提高Oracle数据库管理的效率。记住,实践是最好的老师,结合实际操作来学习这些概念和命令,将使你更深入地掌握SQLPlus的精髓。

    oracle TestKing Oracle 1z0-020

    Oracle 1z0-020是Oracle公司官方认证的一项考试,主要针对的是Oracle数据库管理的基础知识和技术。这个TestKing Oracle 1z0-020资料包包含了备考这一认证的重要资源,帮助考生掌握必要的技能和知识。 Oracle数据库...

    ORACLE9i官方培训文档----数据库管理基础 I

    《ORACLE9i官方培训文档——数据库管理基础 I》是一份详尽的教育资源,旨在帮助初学者和有经验的IT专业人员深入理解Oracle9i数据库的管理基础。这份文档覆盖了Oracle9i数据库的核心概念、安装与配置、性能优化、安全...

    Oracle数据库基础知识--华为

    华为作为全球知名的信息与通信技术(ICT)解决方案供应商,自然也会深入理解和使用Oracle数据库来支持其业务。以下是对"Oracle数据库基础知识--华为"这一主题的详细解释。 一、Oracle数据库概述 Oracle数据库是由甲骨...

    oracle官方文档

    Oracle官方文档是学习和理解Oracle数据库系统的重要资源,它包含了详尽的技术指南、参考手册和最佳实践建议。以下将根据提供的标题和描述,对Oracle9i和Oracle10G的主要知识点进行详细阐述。 1. **Oracle9i基础知识...

    ORacle 全文索引

    Oracle全文索引是Oracle数据库系统中的一个重要特性,它允许用户对数据库中的文本数据进行高效的全文搜索。全文索引使得在海量文本数据中查找特定词汇或短语变得快速且简便,对于那些需要处理大量文本信息的应用程序...

    oracle官网参考资料-最新最完整

    这份“oracle官网参考资料-最新最完整”压缩包包含了最新的Oracle官方文档,这些文档详细且全面地介绍了Oracle数据库的各种特性和使用方法,对于学习、研究或在工作中使用Oracle数据库的人来说是一份极其宝贵的资源...

    oracle 10 Ora 10G 官方文档

    这个官方文档集合包含了丰富的信息,对学习和掌握Oracle 10g的各个方面都极其有益。以下是根据提供的信息,对Oracle 10g的一些关键知识点的详细说明: 1. **SQL编程指南**: - SQL(Structured Query Language)是...

Global site tag (gtag.js) - Google Analytics