Oracle 9i:如何使用元数据确定索引是否聚集?
这个问题几乎概括了这一点,但我将提供更多细节。
我几乎可以安全地假设 Oracle 数据库中的任何主键索引都是聚集的。 但我不是一个可以假设的人。 此外,用户可能创建了一个不是主键的聚集索引。 如果是这样的话,我真的很想知道。
因此,为了真正非常彻底,我想记住(不是我忘记了或其他什么),如何从 Oracle 元数据中确定索引是否是聚集的。
(而且,像往常一样,谷歌就像在垃圾填埋场中寻找一样,寻找你妈妈翻遍的老式动作漫画#1,因为她当时认为它毫无用处。)
谢谢!
The question pretty much sums this up, but I'll provide some more details.
I can almost safely assume that any primary key index in an Oracle database is clustered. But I'm not one to assume. Besides, a user might have created a clustered index that wasn't the primary key. If that's the case, I'd really like to know.
So, in the interests of being really, really thorough, I'd like to remember (not that I forgot or anything), how to determine from the Oracle metadata, whether or not an index is clustered.
(And, per usual, Google was like rooting through a landfill, looking for the vintage Action Comics #1 that your mom through out because she thought it was useless at the time.)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Oracle 不像 SQL Server 那样有“聚集索引”的概念。 一般来说,Oracle 表是“堆”,数据没有特定的顺序存储。 有一种特殊类型的表,称为 INDEX ORGANIZED 表,(顾名思义)这是一个像索引一样组织的表。 然而,在 Oracle 中,大多数表不会是索引组织的 - 而我的理解是 SQL Server 中的大多数表确实有聚集索引。
不要试图将所有 Oracle 表声明为索引组织以尝试模拟 SQL Server; 适合一种 DBMS 的方法不一定适合另一种 DBMS。 我建议您阅读Oracle 数据库概念指南 了解 Oracle 的工作原理。
索引组织表由 ALL_TABLES 和 USER_TABLES 中的 IOT_TYPE = 'IOT' 标识。
Oracle does not have the concept of "clustered indexes" as SQL Server does. In general, Oracle table are "heaps" with the data stored in no particular order. There is a special type of table called an INDEX ORGANIZED table, which is (as its name suggests) a table that is organised like an index. However, in Oracle most tables would not be index organized - whereas my understanding is that most tables in SQL Server do have a clustered index.
Do not be tempted to declare all your Oracle tables as index organized in an attempt to emulate SQL Server; what is right for one DBMS is not necessarily right for another. I suggest you read the Oracle Database Concepts guide to get to know how Oracle works.
Index organized tables are identified by IOT_TYPE = 'IOT' in ALL_TABLES and USER_TABLES.
在 SQL Server 世界中称为聚集索引,在 Oracle 世界中称为索引组织表。 表元数据可在 all_tables 或 user_tables 系统视图中 此处描述。 浏览该链接后我的猜测是,您可以通过检查 IOT_TYPE 列是否为非空来确定表是索引组织的。
What is known as a clustered index in SQL Server world is in Oracle world called an Index Organized Table. Table metadata is available in the all_tables or user_tables system views described here. My guess after skimming that link is that you can determine that a table is index-organized by checking whether the IOT_TYPE column is non-null.