Important update:
The rules for identification of candidates for index coalescing/rebuilding
depend on your specific index state. See
MOSC notes 989186.1,
122008.1, 989093.1 for Oracle’s suggestions on when to
coalesce/rebuild indexes. Also see my
notes on index
coalesce/rebuilding and note this demonstration
of an index that benefits from
scheduled oracle index coalesce/rebuilding.
Oracle Index rebuilding
There is a lot of great information
about Oracle index rebuilding, and current research reveals how
Oracle rebuilds indexes.
Index rebuilding is risk free when done properly, and on
OTN, Chen Shapira
reports that an
index rebuild reduced index range scan I/O:
"We noticed no change of the
execution plan after rebuild. The plan was exactly the same, but an
index scan that required lots of block reads and was very costly,
now takes significantly less. Which is exactly what we needed!"
Check out
our notes on the subject:
Oracle Index rebuilding details and scripts
When can we "prove" a benefit from an index rebuild? Here,
Robin Schumacher
proves that an index that is rebuilt in a larger tablespace will
contain more index entries be block, and have a flatter structure:
"As you can see, the amount of logical
reads has been reduced in half simply by using the new 16K
tablespace and accompanying 16K data cache."
In an OracleWorld 2003
presentation titled “Oracle Database 10g: The Self-Managing
Database” by Sushil Kumar of Oracle Corporation, Kumar
states that the new Automatic Maintenance Tasks (AMT) Oracle10g
feature will "automatically detect and re-build sub-optimal
indexes.“
This
Kim Floss article shows the Oracle 10g segment advisor
recommending a rebuild of an index:
“The page lists all
the segments (table, index, and so on) that constitute the
object under review. The default view ("View Segments
Recommended to Shrink") lists any segments that have free space
you can reclaim.”

Oracle index rebuild advisor (Source: Oracle Corporation)
See my related notes on index rebuilding:
Oracle
author claims to have perfected script to detect bad indexes
In this article, author
Boris Milrud says that Oracle
indexes are not self-balancing and proposed a method for detecting
when an index needs rebuilding. Milrud notes that Oracle b-tree indexes
become out of balance via high DML and he claims that they have
lower performance:
"Oracle indexes are not
self-balancing. They become fragmented after a large number of
INSERTs and DELETEs, which may lead to significant performance
degradation. In this 10-Minute Solution I show you how to detect
these "out-of-shape" indexes and cure them.
The author claims that these statistics
are relevant to the index rebuilding decision:
"The following INDEX_STATS columns are especially useful:
-
height refers to the maximum number of levels
encountered within the index. An index could have 90 percent of the
nodes at three levels, but excessive splitting and spawning in one
area of the index with heavy DML operations could make nodes in that
area to have more than three levels.
-
lf_rows refers to the total number of leafs nodes in
the index.
-
del_lf_rows refers to the number of leaf rows that
have been marked deleted as a result of table DELETEs."
Milrud
also claims that an index rebuild made a batch job run 1000x
faster:
"In other words, massive DELETEs seemed to damage certain index
areas, but leave other areas intact.
Anyway, it was clear to me that it was high time to fix that
index! After I added code to rebuild the index at the end of the
procedure and recompiled it, the next run took only 14 seconds."
|