Oracle Index Internals
ZT from
http://hi.baidu.com/dbaeyes/blog/item/5bd7c31c3c63838087d6b616.html
[@more@]摘錄自Oracle Index InternalsClassic Oracle Index Myths
Oracle B-tree indexes can become “unbalanced” over time and need to be rebuilt
Deleted space in an index is “deadwood” and over time requires the index to be rebuilt
If an index reaches “x” number of levels, it becomes inefficient and requires the index to be rebuilt
If an index has a poor clustering factor, the index needs to be rebuilt
To improve performance, indexes need to be regularly rebuilt
Index Fundamentals
Oracle’s implements a form of B*Tree index
Oracle’s B-Tree index is always balanced. Always.
Index entries must always be ordered.
An update consists of a delete and an insert
Each leaf block has pointers to next/previous blocks
Each leaf block contains the index entry with corresponding rowid
Index scans use ‘sequential’, single block reads(with exception of Fast Full Index Scan)
Index Rebuilds
? As discussed, most indexes are efficient at allocating and reusing space
? Randomly inserted indexes operate at average 25% free space
? Monotonically increasing indexes operate at close to 0% free space
? Deleted space is generally reusable
? Only in specific scenarios could unused space be expected to be higher and remain unusable
? So when may index rebuilds be necessary ?
Conditions for Rebuilds
Large free space (generally 50%+), which indexes rarely reach, and
Large selectivity, which most index accesses never reach, and
Response times are adversely affected, which rarely are.
Note requirement of some free space anyways to avoid insert and subsequent free space issues
Benefit of rebuild based on various dependencies which include:
– Size of index
– Clustering Factor
– Caching characteristics
– Frequency of index accesses
– Selectivity (cardinality) of index accesses
– Range of selectivity (random or specific range)
– Efficiency of dependent SQL
– Fragmentation characteristics (does it effect portion of index frequently used)
– I/O characteristics of index (serve contention or I/O bottlenecks)
– The list goes on and on ….
Other Rebuild Issues To Consider Other Rebuild Issues To Consider
More efficient index structures can reduce stress on buffer cache. Harder to formulate but requires consideration
If you have the resources and you have the appropriate maintenance window, then the cost vs. benefit equation more favorable to rebuild
– Benefit maybe low but perhaps so is the relative cost
Rebuild or Coalesce ?
Index Coalesce
More efficient, less resource intensive, less
locking issues than rebuild option
Can significantly reduce number of leaf blocks in
some scenarios
Requires sum of free space to exceed 50% +
pctfree in consecutive leaf blocks
However, as generally needs excessive 50%+
freespace for rebuild to be effective
Does not reduce index height
alter index bowie_idx coalesce;
Summary
The vast majority of indexes do not require rebuilding
Oracle B-tree indexes can become “unbalanced” and need to be rebuilt is a myth
Deleted space in an index is “deadwood” and over time requires the index to be rebuilt is a myth
If an index reaches “x” number of levels, it becomes inefficient and requires the index to be rebuilt is a myth
If an index has a poor clustering factor, the index needs to be rebuilt is a myth
To improve performance, indexes need to be regularly rebuilt is a myth
Cost =
BLevel +
Index Selective × Leaf Blocks
[ + Table Selective × Clustering Factor]
[ - 1]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/82387/viewspace-1030109/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle internalsOracle
- Oracle Database Internals FAQOracleDatabase
- The Internals of PostgreSQLSQL
- Oracle Internals Notes : Controlfile DumpsOracle
- JonathanLewis新書:Oracle Core: Essential Internals for DBAs and Developers新書OracleDeveloper
- oracle index unusableOracleIndex
- oracle document indexOracleIndex
- The Internals of PostgreSQL學習SQL
- ASM Metadata and InternalsASM
- 【Oracle】global index & local index的區別OracleIndex
- oracle index索引原理OracleIndex索引
- zt_oracle indexOracleIndex
- oracle hint_no_indexOracleIndex
- oracle index monitoringOracleIndex
- oracle index 聚集因子OracleIndex
- oracle hints index格式OracleIndex
- oracle hint之full,index,index_asc,index_desc,index_combile示例OracleIndex
- oracle hint之hint_index_ffs,index_joinOracleIndex
- zt_Oracle shared pool internals_共享池_shared_poolOracle
- ORACLE中index的rebuildOracleIndexRebuild
- oracle invisible index與unusable index的區別OracleIndex
- go-internals 翻譯專案Go
- Oracle索引分裂(Index Block Split)Oracle索引IndexBloC
- oracle hint_no_parallel_no_parallel_indexOracleParallelIndex
- oracle hint_parallel_parallel_indexOracleParallelIndex
- Oracle alter index rebuild 說明OracleIndexRebuild
- [轉載]oracle_Bitmap IndexOracleIndex
- oracle INDEX BY Pl/sql陣列OracleIndexSQL陣列
- Oracle的Index-3(轉)OracleIndex
- Oracle的Index-2(轉)OracleIndex
- Oracle的Index-1(轉)OracleIndex
- Oracle筆記 之 索引(index)Oracle筆記索引Index
- oracle 9i index bug?OracleIndex
- oracle index索引結構(一)OracleIndex索引
- oracle dml與索引index(一)Oracle索引Index
- oracle 點陣圖索引(bitmap index)Oracle索引Index
- How to Specify an INDEX Hint oracle官方文件IndexOracle
- Oracle Index-organized table (IOT)概述OracleIndexZed