【翻译自mos文章】关于分区索引:Global, Local, Prefixed and Non-Prefixed
来源于:
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的更多相关文章
- 【翻译自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 ...
- 【翻译自mos文章】job 不能自己主动执行--这是另外一个mos文章,本文章有13个解决方法
job 不能自己主动执行--这是另外一个mos文章 參考原文: Jobs Not Executing Automatically (Doc ID 313102.1) 适用于: Oracle Datab ...
- 【翻译自mos文章】SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描
SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描 參考原文: SYS_OP_C2C Causing Full Table/Index Scans (Doc ID 732666.1) 适用于: ...
- 【翻译自mos文章】改变数据库用户sysman(该用户是DB Control Repository 的schema)password的方法
改变数据库用户sysman(该用户是DB Control Repository 的schema)password的方法 參考原文: How To Change the Password of the ...
- 【翻译自mos文章】oracle支持在RDBMS HOME 下的 符号链接( Symbolic Links)吗?
oracle支持在RDBMS HOME 下的 符号链接( Symbolic Links)吗? 參考原文: Does Oracle support Symbolic Links in the RDBMS ...
- 【翻译自mos文章】使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法
使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法 參考原文: How to Copy asm files between remote ASM instances usi ...
- 【翻译自mos文章】oracle db 中的用户账户被锁--查看oracle用户的尝试次数
參考原文: Users Accounts Getting Locked. (Doc ID 791037.1) 事实上这个文章是为oracle 别的软件产品写的,只是涉及到user 锁定问题.那还是跟d ...
- 【翻译自mos文章】11gR2中的asm后台进程
11gR2中的asm后台进程 參考原文: ASM Background Processes in 11.2 (Doc ID 1641678.1) 适用于: Oracle Database - Ente ...
- 【翻译自mos文章】在10g中,当发生ORA-00020时,sqlplus登陆会报“connected to an idle instance”
在10g中.当发生ORA-00020时,sqlplus登陆会报"connected to an idle instance" 来源于: Sqlplus Logon Reports ...
随机推荐
- Java数据结构-------List
三种List:ArrayList,Vector,LinkedList 类继承关系图 ArrayList和Vector通过数组实现,几乎使用了相同的算法:区别是ArrayList不是线程安全的,Vect ...
- 洛谷P1279 字串距离
题目描述 设有字符串X,我们称在X的头尾及中间插入任意多个空格后构成的新字符串为X的扩展串,如字符串X为”abcbcd”,则字符串“abcb□cd”,“□a□bcbcd□”和“abcb□cd□”都是X ...
- css create 多边形 polygon
案例: 代码: element.style { width: 0; height: 0; /* border-left: 50px solid transparent; */ border-rig ...
- configurationmanager.getsection usage
public static void CreateAppSettings() { // Get the application configuration file. System.Configura ...
- 【winform】基于UserControl实现webBrower组件时html页面元素加载及onclick事件监听实现
[背景]基于System.Windows.Forms.UserControl实现的webBrower组件在html内使用window.external调用winform事件失败. [解决思路]借助wi ...
- linux下轻松修改pdf文件
前几天使用firefox打印了一个网页,后来查看有很多页面都是评论,对我来说,实在没有什么用处,就想把多余的内容给删除了,后来,终于找到了一个工具:pdf mod非常不错的工具,直接打开文件,选择要删 ...
- python 高阶函数和匿名函数
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 2017/11/02 22:46 # @Author : lijunjiang # @Fi ...
- 组队训练3回放 ——hnqw1214
组队训练3回放 练习赛过程回放: 开场先看最后一题, 发现是专题训练时做过的网络流原题, cst照着之前的打一遍,第一遍WA, 发现数组开小了,改大后AC. 这时候qw看B题, 一开始想不到方法, c ...
- Oracle SID爆破工具SidGuess
Oracle SID爆破工具SidGuess 在Oracle中,SID是System IDentifier的缩写.SID是一个数据库的唯一标识符.当用户希望远程连接Oracle数据库时,则需要知道 ...
- bzoj 5125: [Lydsy1712月赛]小Q的书架
新学了一波 决策单调性 dp 套路.... 这种dp一般是长这样的 => f[i][j] = max/min { f[i-1][k] + cost(k+1,j)} ,其中cost函数满足四边形 ...