Monday, September 28, 2009

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.

1. B-Tree Indexes
-------------
These indexes 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.

2. Bitmap Indexes
--------------
These indexes 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.

3. 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 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.

4. 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.

5. Reverse Key Indexes
-------------------
These indexes 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.

6. Index-Organized Tables or Appending Columns to an Index
--------------------------------------------------------
One of the easiest ways to speed up a query is to reduce the number of logical I/Os by eliminating a table access from the execution plan. This can be done by appending to the index all columns referenced by the query. These columns are the select list
columns, and any required join or sort columns. This technique is particularly useful
in speeding up online applications response times when time-consuming I/Os are
reduced. This is best applied when testing the application with properly sized data for the first time.
The most aggressive form of this technique is to build an index-organized table (IOT). However, you must be careful that the increased leaf size of an IOT does not
undermine the efforts to reduce I/O.

No comments: