Oracle reverse key index tips
It has been suggested that using reverse-key
indexes will speed-up Oracle INSERT statements, especially with an
increasing key, like an index on an Oracle sequence (which is used for the primary key
of the target table). For
large batch inserts, Oracle reverse key indexes will greatly speed-up data
loads because the high-order index key has been reversed.
Note: An Oracle reverse key index DOES
NOT change the functionality of the index, and it's not the same as
reversing the index key values.
In general, an Oracle reverse key index relieve
data block contention (buffer busy waits) when inserting into any
index where the index key is a monotonically increasing value which
must be duplicated in the higher-level index nodes.
With the index key reversal, only the lowest-level index
node is changed, and not all of the high-order index nodes,
resulting in far faster insert speed. For updates, Oracle
updates the index nodes with each update statement.
Depending on the size of your update batch, it's often faster to
drop, update and then re-build the index. If you have more than one
CPU, you might consider doing a parallel index rebuild for faster
speed. It splits-up the full-table scan:
From the Oracle documentation:
Creating a reverse key
index, compared to a standard index, reverses the bytes of each
column indexed (except the rowid) while keeping the column order.
Such an arrangement can help avoid performance degradation with
Oracle9i Real Application Clusters where modifications to the index
are concentrated on a small set of leaf blocks.
By reversing the keys
of the index, the insertions become distributed across all leaf keys
in the index.
Reverse key indexes are also used to reduce
contention when using OPS, RAC and Grid:
reduce "hot spots" in indexes, especially primary key indexes, by
reversing the bytes of the leaf blocks and thus eliminating the
contention for leaf blocks across instances.
Rich Niemeic also offers advice on buffer busy waits and
If it's on an index
block, you should rebuild the index, partition the index, or use a
reverse key index.
Also, see my
notes on tuning to
reduce index contention.