来源于:

Partitioned Indexes: Global, Local, Prefixed and Non-Prefixed (文档 ID 69374.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 8.0.3.0 and later

Information in this document applies to any platform.

PURPOSE

To differentiate between types of partitioned indexes.

SCOPE

Engineers and customers.

DETAILS

RELATED DOCUMENTS

-----------------

 

Oracle Server Concepts



The different types of partitioned indexes are among the least-understood 

features associated with Oracle partitioned tables. This note aims to set 

out the definitions of each index type.



A partitioned table may have either partitioned or non-partitioned indexes; a 

non-partitioned table may have partitioned indexes. In practice, though, most  

partitioned indexes will be on partitioned tables.

LOCAL INDEXES

-------------



A local index is equi-partitioned with the underlying table, so each index 

partition has entries for rows in a single table partition. The partition 

bounds will be the same as for the table itself.



A local index may be prefixed or non-prefixed. A prefixed index is partitioned 

on the leftmost column(s) in the index. Since a local index, by definition, is 

partitioned on the same key as the table, a local prefixed index will have the 

table partition key as its leftmost column. 



So if we use as an example the following partitioned table:



    CREATE TABLE dept

    (deptno NUMBER NOT NULL,

    dname VARCHAR2(10) NOT NULL,

    loc VARCHAR2(14))

    PARTITION BY RANGE (deptno)

    (PARTITION part1 VALUES LESS THAN (30),

    PARTITION part2 VALUES LESS THAN (MAXVALUE));



Then a local prefixed index would be created as follows:



    CREATE  INDEX deptloc1_idx ON dept(deptno) LOCAL;



though we could be much more specific about partition names and tablespaces if 

we chose.



Local non-prefixed indexes will not have the table's partitioning key as their 

leftmost column. For example:



    CREATE  INDEX deptloc2_idx ON dept(loc) LOCAL;



Each partition of a non-prefixed local index will of course potentially contain the full 

range of possible key values, as shown in the diagram below:



          |                           |

       -------                     -------

      |       |                   |        |

      A..     Z..                 A..      Z..    (for a VARCHAR2 column)



This may look inefficient, but remember that we can search all the index 

partitions in parallel.





GLOBAL INDEXES

--------------



A global index is partitioned, but along different lines from the table. It 

may be on the same key, but different ranges; or it could be on a different 

key altogether.



Global non-prefixed indexes are not supported. This means that the index 

partitioning key must always be the leftmost index column. Anything else will 

raise the error:



ORA-14038:  GLOBAL partitioned index must be prefixed



Most examples of global indexes, in documentation and training material, use 

the same partitioning key as for the table, with different ranges. But global 

indexes are most powerful if they are partitioned on a different column from 

the table. For example (recalling that the DEPT table itself is partitioned on 

DEPTNO):



CREATE INDEX dept_idx ON dept(dname)

GLOBAL PARTITION BY RANGE (dname)

(PARTITION p1 VALUES LESS THAN ('N'),

PARTITION p2 VALUES LESS THAN (MAXVALUE));



To illustrate the usefulness of global indexes, imagine that we have a large 

fact table partitioned on a DATE column. We frequently need to search the table 

on a VARCHAR2 column (VCOL) which is not part of the table's partition key. 

Assume that there are currently 12 partitions in the table.



We could use 2 possible methods:

    

    A local non-prefixed index on VCOL:



                |                                         |

             -------                                   -------

            |       |         (10 more                |        |

Values:     A..     Z..   partitions here)            A..      Z.. 



        Or a global prefixed index on VCOL:



                 |                                         |

              -------                                   -------

             |       |         (10 more                |        |

Values:      A..     D..   partitions here)            T..      Z.. 



A global prefixed index would usually be the best choice for a unique index on 

our example VCOL column. For nonunique indexes, the issue is whether we can use

parallel index searches (local non-prefixed) or whether we need a serial search,

even at the expense of the greater maintenance problems of global indexes.

【翻译自mos文章】关于分区索引:Global, Local, Prefixed and Non-Prefixed的更多相关文章

  1. 【翻译自mos文章】11.2.0.4及更高版本号的asm实例中MEMORY_TARGET 和 MEMORY_MAX_TARGET的默认值和最小值

    [翻译自mos文章]11.2.0.4及更高版本号的asm实例中MEMORY_TARGET 和 MEMORY_MAX_TARGET的默认值和最小值 来源于: Default and Minimum ME ...

  2. 【翻译自mos文章】job 不能自己主动执行--这是另外一个mos文章,本文章有13个解决方法

    job 不能自己主动执行--这是另外一个mos文章 參考原文: Jobs Not Executing Automatically (Doc ID 313102.1) 适用于: Oracle Datab ...

  3. 【翻译自mos文章】SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描

    SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描 參考原文: SYS_OP_C2C Causing Full Table/Index Scans (Doc ID 732666.1) 适用于: ...

  4. 【翻译自mos文章】改变数据库用户sysman(该用户是DB Control Repository 的schema)password的方法

    改变数据库用户sysman(该用户是DB Control Repository 的schema)password的方法 參考原文: How To Change the Password of the ...

  5. 【翻译自mos文章】oracle支持在RDBMS HOME 下的 符号链接( Symbolic Links)吗?

    oracle支持在RDBMS HOME 下的 符号链接( Symbolic Links)吗? 參考原文: Does Oracle support Symbolic Links in the RDBMS ...

  6. 【翻译自mos文章】使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法

    使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法 參考原文: How to Copy asm files between remote ASM instances usi ...

  7. 【翻译自mos文章】oracle db 中的用户账户被锁--查看oracle用户的尝试次数

    參考原文: Users Accounts Getting Locked. (Doc ID 791037.1) 事实上这个文章是为oracle 别的软件产品写的,只是涉及到user 锁定问题.那还是跟d ...

  8. 【翻译自mos文章】11gR2中的asm后台进程

    11gR2中的asm后台进程 參考原文: ASM Background Processes in 11.2 (Doc ID 1641678.1) 适用于: Oracle Database - Ente ...

  9. 【翻译自mos文章】在10g中,当发生ORA-00020时,sqlplus登陆会报“connected to an idle instance”

    在10g中.当发生ORA-00020时,sqlplus登陆会报"connected to an idle instance" 来源于: Sqlplus Logon Reports ...

随机推荐

  1. 获取所有querystring变量名

    原文发布时间为:2009-12-04 -- 来源于本人的百度文章 [由搬家工具导入] protected void Page_Load(object sender, EventArgs e)    { ...

  2. 关于百度富文本编辑器UEdit的初始化内容失败问题

    百度富文本编辑器毫无疑问是强大的,但也会出问题.这个问题是在脚本中普遍存在的,由异步性导致的加载顺序问题. 我们使用 var ue = UE.getEditor('editor', {}); 创建实例 ...

  3. hdu 3001 Travelling 经过所有点(最多两次)的最短路径 三进制状压dp

    题目链接 题意 给定一个\(N\)个点的无向图,求从任意一个点出发,经过所有点的最短路径长度(每个点至多可以经过两次). 思路 状态表示.转移及大体思路 与 poj 3311 Hie with the ...

  4. SQL语句的执行顺序(转载+不同意见)

    MySQL的语句一共分为11步,如下图所标注的那样,最先执行的总是FROM操作,最后执行的是LIMIT操作.其中每一个操作都会产生一张虚拟的表,这个虚拟的表作为一个处理的输入,只是这些虚拟的表对用户来 ...

  5. hdu 3657 最小割的活用 / 奇偶方格取数类经典题 /最小割

    题意:方格取数,如果取了相邻的数,那么要付出一定代价.(代价为2*(X&Y))(开始用费用流,敲升级版3820,跪...) 建图:  对于相邻问题,经典方法:奇偶建立二分图.对于相邻两点连边2 ...

  6. iOS9.0 友盟分享详细过程

    一: 申请友盟的AppKey(友盟的Key是根据应用的名称生成的!) 在友盟注册了你自己的开发者账号后就可以申请AppKey了.然后在这个方法里面设置Key - (BOOL)application:( ...

  7. 2016集训测试赛(二十一)Problem C: 虫子

    题目大意 给你一棵树, 每个点有一个点权. 有两种操作: link / cut 修改某个点的点权 每次操作后, 你要输出以下答案: 在整棵树中任意选两个点, 这两个点的LCA的期望权值. Soluti ...

  8. c++ 幕客网

    http://m.imooc.com/course/list.html?c=cplusplus http://coding.imooc.com/ http://www.imooc.com/act/al ...

  9. DEDECMS图片集上传图片出错302的解决办法

    无忧主机(www.51php.com)小编今天在调试dede网站的时候发现了一个问题,因为小编想在网站上增加一个图片集的栏目,于是就到后台图片集栏目去添加内容,谁知在上传图片的时候给我弹出个错误信息框 ...

  10. 实例化Spring容器的两种常用方式

    //在类路径下寻找配置文件来实例化容器 ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]{"b ...