`
473687880
  • 浏览: 535534 次
文章分类
社区版块
存档分类
最新评论

Index-Organized Tables

 
阅读更多

Index-Organized Tables

An index-organized table is a table stored in a variation of a B-tree index structure. In a heap-organized table, rows are inserted where they fit. In an index-organized table, rows are stored in an index defined on the primary key for the table. Each index entry in the B-tree also stores the non-key column values. Thus, the index is the data, and the data is the index.Applications manipulate index-organized tables just like heap-organized tables, using SQL statements.

For an analogy of an index-organized table, suppose a human resources manager has a book case of cardboard boxes. Each box is labeled with a number—1, 2, 3, 4, and so on—but the boxes do not sit on the shelves in sequential order. Instead, each box contains a pointer to the shelf location of the next box in the sequence.

Folders containing employee records are stored in each box. The folders are sorted by employee ID. Employee King has ID 100, which is the lowest ID, so his folder is at the bottom of box 1. The folder for employee 101 is on top of 100, 102 is on top of 101, and so on until box 1 is full. The next folder in the sequence is at the bottom of box 2.

In this analogy, ordering folders by employee ID makes it possible to search efficiently for folders without having to maintain a separate index. Suppose a user requests the records for employees 107, 120, and 122. Instead of searching an index in one step and retrieving the folders in a separate step, the manager can search the folders in sequential order and retrieve each folder as found.

Index-organized tables provide faster access to table rows by primary key or a valid prefix of the key. The presence of non-key columns of a row in the leaf block avoids an additional data block I/O. For example, the salary of employee 100 is stored in the index row itself. Also, because rows are stored in primary key order, range access by the primary key or prefix involves minimal block I/Os. Another benefit is the avoidance of the space overhead of a separate primary key index.

Index-organized tables are useful when related pieces of data must be stored together or data must be physically stored in a specific order. This type of table is often used for information retrieval, spatial (see "Overview of Oracle Spatial" on page 19-14), and OLAP applications (see "OLAP" on page 17-20).

Index-Organized Table Characteristics

The database system performs all operations on index-organized tables by manipulating the B-tree index structure. Table 3–4 summarizes the differences between index-organized tables and heap-organized tables.


Figure 3–3 illustrates the structure of an index-organized departments table. The leaf blocks contain the rows of the table, ordered sequentially by primary key. For example, the first value in the first leaf block shows a department ID of 20, department name of Marketing, manager ID of 201, and location ID of 1800.


An index-organized table stores all data in the same structure and does not need to store the rowid. As shown in Figure 3–3, leaf block 1 in an index-organized table might contain entries as follows, ordered by primary key:


20,Marketing,201,1800
30,Purchasing,114,1700


Leaf block 2 in an index-organized table might contain entries as follows:


50,Shipping,121,1500
60,IT,103,1400


A scan of the index-organized table rows in primary key order reads the blocks in the following sequence:


1.Block 1
2.Block 2


To contrast data access in a heap-organized table to an index-organized table, suppose block 1 of a heap-organized departments table segment contains rows as follows:


50,Shipping,121,1500
20,Marketing,201,1800


Block 2 contains rows for the same table as follows:


30,Purchasing,114,1700
60,IT,103,1400

A B-tree index leaf block for this heap-organized table contains the following entries, where the first value is the primary key and the second is the rowid:
20,AAAPeXAAFAAAAAyAAD
30,AAAPeXAAFAAAAAyAAA
50,AAAPeXAAFAAAAAyAAC
60,AAAPeXAAFAAAAAyAAB
A scan of the table rows in primary key order reads the table segment blocks in the following sequence:


1.Block 1
2.Block 2
3.Block 1
4.Block 2


Thus, the number of block I/Os in this example is double the number in the index-organized example.

Index-Organized Tables with Row Overflow Area

When creating an index-organized table, you can specify a separate segment as a row overflow area. In index-organized tables, B-tree index entries can be large because they contain an entire row, so a separate segment to contain the entries is useful. In contrast, B-tree entries are usually small because they consist of the key and rowid.
If a row overflow area is specified, then the database can divide a row in an index-organized table into the following parts:
■The index entry
This part contains column values for all the primary key columns, a physical rowid that points to the overflow part of the row, and optionally a few of the non-key columns. This part is stored in the index segment.
■The overflow part
This part contains column values for the remaining non-key columns. This part is stored in the overflow storage area segment.

Logical Rowids and Physical Guesses
Secondary indexes use the logical rowids to locate table rows. A logical rowid includes a physical guess, which is the physical rowid of the index entry when it was first made. Oracle Database can use physical guesses to probe directly into the leaf block of the index-organized table, bypassing the primary key search. When the physical location of a row changes, the logical rowid remains valid even if it contains a physical guess that is stale.
For a heap-organized table, access by a secondary index involves a scan of the secondary index and an additional I/O to fetch the data block containing the row. For index-organized tables, access by a secondary index varies, depending on the use and accuracy of physical guesses:
■Without physical guesses, access involves two index scans: a scan of the secondary index followed by a scan of the primary key index.
■With physical guesses, access depends on their accuracy:
–With accurate physical guesses, access involves a secondary index scan and an additional I/O to fetch the data block containing the row.

–With inaccurate physical guesses, access involves a secondary index scan and an I/O to fetch the wrong data block (as indicated by the guess), followed by an index unique scan of the index organized table by primary key value.
Bitmap Indexes on Index-Organized Tables
A secondary index on an index-organized table can be a bitmap index. As explained in "Bitmap Indexes" on page 3-13, a bitmap index stores a bitmap for each index key.
When bitmap indexes exist on an index-organized table, all the bitmap indexes use a heap-organized mapping table. The mapping table stores the logical rowids of the index-organized table. Each mapping table row stores one logical rowid for the corresponding index-organized table row.
The database accesses a bitmap index using a search key. If the database finds the key, then the bitmap entry is converted to a physical rowid. With heap-organized tables, the database uses the physical rowid to access the base table. With index-organized tables, the database uses the physical rowid to access the mapping table, which in turn yields a logical rowid that the database uses to access the index-organized table. Figure 3–4 illustrates index access for a query of the departments_iot table.




http://www.blogjava.net/wxqxs/archive/2008/10/14/237181.html

分享到:
评论

相关推荐

    Expert.Oracle.Indexing.and.Access.Paths.2nd.epub

    Index-organized Tables Chapter 5. Specialized Indexes Chapter 6. Partitioned Indexes Chapter 7. Tuning Index Usage Chapter 8. Maintaining Indexes Chapter 9. SQL Tuning Advisor Chapter 10. In Memory ...

    oracle优化总结

    - **Index-Organized Tables (IOT)**:数据按索引顺序存储,适用于经常按索引列进行访问的场景。 - **Partitioned Tables**:将大表分成较小的部分,便于管理和查询。 **三、项目总结** 1. **数据库文件读写压力**...

    oracle笔记

    在"源码"这一标签下,笔记可能涉及到Oracle的内部架构和工作流程,比如查询优化器的工作原理、表的物理存储结构(如heap tables、index-organized tables)、事务处理机制,甚至可能深入到Oracle的源代码级别去解析...

    oracle高效设计中英文版一套

    他还强调了表的组织方式,如heap tables、index-organized tables (IOTs) 和 cluster tables的适用场景,以及如何根据业务需求选择合适的数据存储结构。 三、索引策略 索引是提高查询性能的关键因素。书中详述了B树...

    Oracle数据库实验.zip

    7. **Index-Organized Tables (IOT)**: 一种特殊类型的表,其中数据按索引顺序存储,可以提高特定类型查询的性能。 8. ** flashback features**: 包括闪回查询、闪回表和闪回事务,使用户能够查看和恢复到过去的...

    PL/SQL 参考资料

    标签中提到了“Oracle”,这意味着这份资料不仅涵盖了PL/SQL的基础,还会涉及到Oracle数据库特有的功能,比如动态SQL、包(Packages)、索引组织表(Index-Organized Tables, IOTs)以及PL/SQL中的事务控制等。...

    PL/SQL SQL ORACLE

    同时,对于Oracle特有的特性,如Materialized Views(物化视图)、Index-Organized Tables(索引组织表)和Advanced Queuing(高级队列)等,也是提升数据库管理能力的关键。 总的来说,精通PL/SQL、SQL和Oracle...

    Oracle 9i数据库高级管理.rar

    3. Index-organized Tables (IOTs):通过将数据直接存储在索引结构中,提高了对索引主导查询的响应时间。 三、安全策略 Oracle 9i提供了更强大的用户权限和角色管理,支持细粒度访问控制(FGAC)以实现更精确的数据...

    itjob绝密oracle培训教程课本+PPT

    4. Oracle存储结构:深入理解表的存储方式,如heap tables、index-organized tables以及B树索引的工作原理。 5. 数据仓库与OLAP:介绍数据仓库设计原则,星型和雪花模式,以及Oracle的OLAP功能如物质化视图、快速聚...

    《Oracle10g 数据仓库》英文版

    5. **性能优化**:Oracle 10g 提供了各种性能优化工具和技术,如Materialized Views、Index-Organized Tables (IOT) 和Partitioning。书中将详细解释如何利用这些功能来提高查询速度和数据处理效率。 6. **安全与...

    Tuning Sql Queries with Oracle

    索引组织表(Index-Organized Tables,IOT)是一种特殊的数据结构,其中数据行按索引顺序物理存储。这种结构非常适合于那些经常根据主键或其他唯一索引进行访问的表,因为它可以直接定位到数据行,避免了额外的查找...

    Oracle逻辑备用数据库配置.doc

    - 不支持的表、序列和视图包括:在`SYS`模式下定义的表和序列、包含不支持数据类型的表、使用了段压缩(`SEGMENT COMPRESSION`)的表、索引组织表(`INDEX-ORGANIZED TABLES`)。 - 可以通过查询`DBA_LOGSTDBY_...

    High.performance.Oracle.pdf

    5. **表和存储优化**:讨论如何通过选择合适的存储组织方式(如heap tables、index-organized tables)和压缩技术来优化空间利用率和访问速度。 6. **数据库架构设计**:良好的数据库架构是性能的基础。书可能会...

    OCP.Oracle.11g.New.Features.for.Administrators.Exam.Guide.

    - **Range Partitioning on Index-Organized Tables (IOT)**:扩展了分区策略,支持IOT的范围分区。 - **List and Hash Partitioning Enhancements**:提高了列表和哈希分区的效率和灵活性。 10. **DML ...

    Oracle 10G DBA Reference

    9. **数据仓库与OLAP**:Oracle 10G对数据仓库支持进行了增强,包括星型和雪花模式的物理设计,以及快速查询优化(如Materialized Views和Index-Organized Tables)。 10. **故障诊断与修复**:学习如何使用Trace...

    Oracle数据库学习笔记 四

    8. **索引组织表 (Index-Organized Tables, IOT)**: 数据直接存储在索引中,搜索基于主键而非ROWID。与普通表相比,IOT在某些场景下提供更快的查询速度,但不支持某些功能,如分布、复制和分区。 以上是Oracle...

    oracle 11g sql pl sql 从入门到精通 全本

    3. Index-Organized Tables (IOT):索引驱动的表结构,数据通过主键索引存储,优化查询性能。 4. 触发器(TRIGGER):自动执行的代码,响应特定的数据库事件,如INSERT、UPDATE、DELETE。 5. 连接池(Connection ...

    oracle.data.warehouse.management

    - **索引组织表 (Index-Organized Tables, IOTs)**:在 Oracle 中,这种类型的表可以提高查询性能,尤其是在频繁执行范围查询时。 - **压缩 (Compression)**:减少数据占用的空间,从而节省存储成本并提高查询性能。...

    Oracle修改存储空间相关sql

    10. 索引组织表(Index-Organized Tables, IOT): 对于主键约束,IOT能节省存储空间,因为索引和数据存储在一起。创建IOT: ```sql CREATE TABLE table_name ( ... columns ... ) ORGANIZATION INDEX PRIMARY ...

Global site tag (gtag.js) - Google Analytics