The Internal Structure of Indexes (208)
Oracle uses B-trees to store indexes to speed up data access. With no indexes, you have
to do a sequential scan on the data to find a value. For n rows, the average number of
rows searched is n/2. This does not scale very well as data volumes increase.
Consider an ordered list of the values divided into block-wide ranges (leaf blocks). The
end points of the ranges along with pointers to the blocks can be stored in a search tree
and a value in log(n) time for n entries could be found. This is the basic principle
behind Oracle indexes.
The upper blocks (branch blocks) of a B-tree index contain index data that points to
lower-level index blocks. The lowest level index blocks (leaf blocks) contain every
indexed data value and a corresponding rowid used to locate the actual row. The leaf
blocks are doubly linked. Indexes in columns containing character data are based on
the binary values of the characters in the database character set.
For a unique index, one rowid exists for each data value. For a nonunique index, the
rowid is included in the key in sorted order, so nonunique indexes are sorted by the
index key and rowid. Key values containing all nulls are not indexed, except for
cluster indexes. Two rows can both contain all nulls without violating a unique index.
索引的內部結構
1. Oracle 索引的基本原理 : 如果將一個已排序的值列劃分為以塊為單位的區間,每個區間的末尾包含
指向下個區間的指標,而搜尋樹中則儲存指向每個區間的指標。此時在 n 行資料中查詢一個值所需的時間為
log(n)。
2. B樹索引的分支塊包含了指向下層索引塊的指標 ,葉子塊包含了被索引的資料值,以及對應的 rowid 。
葉子節點以雙向列表形式連線
3. 對於唯一索引 ,每個索引值對應著唯一的一個 rowid。對於非唯一索引,每個索引值
對應著多個已排序的 rowid。因此在非唯一索引中,索引資料是按照索引鍵及 rowid 共同排序的。
鍵值全部為 NULL 的行不會被索引,只有簇索引例外。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-982565/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 不用SE11建Structure傳Internal Table到Smartforms的方法StructORM
- data structureStruct
- Valuation StructureStruct
- Rebuild IndexesRebuildIndex
- ORACLE INDEXESOracleIndex
- OpenAPI Basic StructureAPIStruct
- VALIDATE STRUCTUREStruct
- Oracle - Tables/IndexesOracleIndex
- Reverse Key IndexesIndex
- ORACLE -> NULL & INDEXESOracleNullIndex
- Overview of Partitioned IndexesViewIndex
- Local Partitioned IndexesIndex
- Global Nonpartitioned IndexesIndex
- Extents in Indexes (19)Index
- 翻譯(九)——Clustered Indexes: Stairway to SQL Server Indexes Level 3IndexAISQLServer
- Data Structure_樹Struct
- sqrt-data-structureStruct
- skip_unusable_indexesIndex
- The Secrets of Oracle Bitmap IndexesOracleIndex
- Restrictions on Create Bitmap IndexesRESTIndex
- Global Range Partitioned IndexesIndex
- Global Hash Partitioned IndexesIndex
- Maintenance of Global Partitioned IndexesAINaNIndex
- Overview of Indexes (194)ViewIndex
- Indexes and Nulls (198)IndexNull
- Data block Structure and Row Piece Structure_20091209BloCStruct
- oracle internalOracle
- VulNyx - Internal
- PHP-leetcode-208PHPLeetCode
- CF208E 題解
- AT_abc208_d 題解
- idea--Project StructureIdeaProjectStruct
- SAP Spartacus Reference App StructureAPPStruct
- 1.2 Physiacel Structure of Database ClusterStructDatabase
- Idea Project Structure配置IdeaProjectStruct
- 學習VALIDATE STRUCTUREStruct
- buffer cache logical structure!Struct
- Program Interface Structure (135)Struct