RelationalDBDesign RelationalDBDesign

Oracle Indexes   «Prev 

Using a Different Index Type

There are several index types available, and each index has benefits for certain situations. The following list gives performance ideas associated with each index type.

B-Tree Indexes

These are the standard index type, and they are excellent for primary key and highly-selective indexes. Used as concatenated indexes, B-tree indexes can be used to retrieve data sorted by the index columns.

Bitmap Indexes

These are suitable for low cardinality data. Through compression techniques, they can generate a large number of rowids with minimal I/O. Combining bitmap indexes on non-selective columns allows efficient AND and OR operations with a great number of rowids with minimal I/O. Bitmap indexes are particularly efficient in queries with COUNT(), because the query can be satisfied within the index.

Function-based Indexes

These indexes allow access through a B-tree on a value derived from a function on the base data. Function-based indexes have some limitations with regards to the use of nulls, and they require that you have the query optimizer enabled.
Function-based indexes are particularly useful when querying on composite columns to produce a derived result or to overcome limitations in the way data is stored in the database. An example of this is querying for line items in an order exceeding a certain value derived from (sales price - discount) x quantity, where these were columns in the table. Another example is to apply the UPPER function to the data to allow case-insensitive searches.

Partitioned Indexes

Partitioning a global index allows partition pruning to take place within an index access, which results in reduced I/Os. By definition of good range or list partitioning, fast index scans of the correct index partitions can result in very fast query times.

Reverse Key Indexes

These are designed to eliminate index hot spots on insert applications. These indexes are excellent for insert performance, but they are limited in that they cannot be used for index range scans.

B*-tree index

Diagram that shows a hierarchy of names displayed in a b-tree index.
  1. Top node: The topmost node provides an entry point. If the desired value is less than “Jones”, the retrieval proceeds to the left. If the desired value is greater than “Jones”, the retrieval proceeds to the right.
  2. Middle nodes: Each node contains comparison values that direct the retrieval to another level of nodes or to the leaf blocks.
  3. Leaf blocks: The leaf blocks contain the actual index values and the ROWIDs for the associated nodes. Each leaf block only contains a few values.
  4. Expanded leaf block: The actual data in the leaf block consists of the value for the index and the ROWID of the row of the data table that contains it.