Oracle中的全局非分区索引

Oracle中的全局非分区索引

本文介绍了Oracle中的全局非分区索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关Oracle分区索引的文档.到处都可以找到本地分区索引和全局分区索引之间的区别,这对我来说很明显.

I am reading up documentation for oracle partitioned indexes. One can find everywhere the distinction between local partitioned index and global partitioned index and that is clear to me.

我很困惑全局"一词并不意味着该索引完全是分区的.

I am confused that word 'global' does not imply that the index is partitioned at all.

例如Thomas Kyte在专家Oracle数据库体系结构"中有几个示例,如下所示:

E.g. Thomas Kyte has several examples in 'Expert Oracle Database Architecture' that looks like this:

create index partitioned_idx_global
on partitioned(timestamp)
GLOBAL;
Index created.

并且可以找到类似的示例,其中关键字GLOBAL后面没有任何分区描述.

And one can find similar examples where the keyword GLOBAL is not followed with any partitioning description elsewhere.

GLOBAL之后没有分区子句,这似乎与创建索引文档.

There is no partitioning clause after GLOBAL which seems to be in contrast to what is allowed in CREATE INDEX docs.

文档为非分区全局索引对我来说也没有太大意义.

The documentation for nonpartitioned global indexes does not make much sense to me either.

本地非分区索引"到底是什么?它甚至不应该存在.

What the heck is 'local nonpartitioned index'? It should not even exist.

因此,最终我的问题是消除混乱.正则索引和全局非分区索引有什么区别?上面的书中引用的语法甚至是合法的"吗?

So ultimately my question is to clear the confusion. What is the difference between regular index and global nonpartitioned index? Is the syntax quoted from the book above even 'legal'?

推荐答案

没有诸如本地非分区索引"之类的内容.似乎可能是文档错误.我认为他们的意思是

There is no such as a "local nonpartitioned index". Seems likely that is a documentation bug. I think what they meant to say was

是的,汤姆·凯特(Tom Kyte)的书中引用的语法是合法的.

So yes, the syntax quoted in Tom Kyte's book is legal.

默认情况下,GLOBAL索引是未分区的.也就是说,表的所有分区都有一个索引.我们可能要执行此操作的主要原因是在整个表上强制执行唯一约束.实际上,很少需要这样做:分区通常仅限于数据仓库,因为DML的锁定程度更高,因此约束执行通常较为宽松.

By default GLOBAL indexes are nonpartitioned. That is, there is one index for all the partitions of the table. The main reason why we might want to do this is to enforce a unique constraint across the entire table. In practice it's rare to need to do this: Partitioning is usually restricted to data warehouses, where constraint enforcement is generally laxer, because DML is more locked down.

链接到的文档显示了如何创建GLOBAL分区索引.这是一种混合结构,使我们可以使用与用于分区数据的分区方案不同的分区方案来构建索引.老实说,我从未在与Partitioning合作过的任何网站上遇到过这种情况.但是,@ matthewmcpeak提出了一种可能有用的方案.因此,为了将来的搜索者的利益,我将他的评论包括在此答案中.

The documentation to which you linked shows how to create GLOBAL partitioned indexes. This is a hybrid construct which allows us to build indexes with a different partitioning scheme from that used to partition the data. To be honest I've never come across this in any site where I've worked with Partitioning. However, @matthewmcpeak suggested a scenario where it could be useful. So I am including his comment in this answer, for the benefit of future Seekers.

这篇关于Oracle中的全局非分区索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 05:08