来源于:

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. Linux服务器之SSH

    SSH 1.ssh是安全的加密协议,用于远程连接linux服务器. 2.ssh默认端口是22,安全协议版本ssh2. 3.ssh服务端主要包含两个服务功能ssh远程连接,sftp服务. 4.linux ...

  2. hdu 5972 Regular Number 字符串Shift-And算法 + bitset

    题目链接 题意 给定两个串\(S,T\),找出\(S\)中所有与\(T\)匹配的子串. 这里,\(T\)的每位上可以有若干(\(\leq 10\))种选择,匹配的含义是:对于\(S\)的子串的每一位, ...

  3. 本机开发Native Development:Invalid path for NDK (转)

    打开window菜单下的preference选项.选择Android,Native Development(本地开发) 选择你的NDK安装目录.但是,这个插件目前仅支持ndk的r4和r5版本,更高版本 ...

  4. android的布局-----GridLayout(网格布局)

    学习导图 (一)简介 网格布局由GridLayout所代表,在android4.0之后新增加的布局管理器,因此需要android4.0之后的版本中使用,如果在更早的平台使用该布局管理器,则需要导入相应 ...

  5. 牛客网 牛客小白月赛2 D.虚虚实实-无向图判欧拉路径

    D.虚虚实实 链接:https://www.nowcoder.com/acm/contest/86/D     这个题是无向图判欧拉路径,首先要判是否连通,然后再判欧拉路径就可以,板子题. 板子来源: ...

  6. hibernate中SQL包含冒号

    当前负责的项目使用的是hibernate,而“:”是hibernate的一个占位符,作为预编译使用的, select tmp.pid from (select pid, loginTime, @i : ...

  7. 安全性测试入门 (四):Session Hijacking 用户会话劫持的攻击和防御

    本篇继续对于安全性测试话题,结合DVWA进行研习. Session Hijacking用户会话劫持 1. Session和Cookies 这篇严格来说是用户会话劫持诸多情况中的一种,通过会话标识规则来 ...

  8. luogu P1345 [USACO5.4]奶牛的电信Telecowmunication

    https://www.luogu.org/problemnew/show/1345 拆点,中间建流量为1的边,跑最小割 #include<cstdio> #include<queu ...

  9. Codeforces 734C [水][暴力][贪心]

    题意: 要生产n个物品,每个花费时间为x. 有两种魔法,每种最多使用1个. 其中第一种魔法可以使每个物品生产的花费时间变为ai,相应的花费是bi;第二种魔法可以减少ci个物品,相应的花费是di,并且保 ...

  10. 适配iOS7之—UITableView和UISearchBar

    iOS7中,如果用UITableViewStyleGrouped的话,里面的cell会比原来的拉长了,这样做应该是为了统一和UITableViewStylePlain风格时cell的大小一致,所以改用 ...