6.4. Using Indexes to Improve Database Performance

Searches performed by client applications can be time and resource intensive, depending on the size of the databases. To help alleviate this problem, use indexes to improve search performance.
Indexes are files stored in the directory databases. Separate index files are maintained for each database in the directory service. Each file is named according to the attribute it indexes. The index file for a particular attribute can contain multiple types of indexes, so several types of index can be maintained for each attribute. For example, a file called cn.db4 contains all of the indexes for the common name attribute.
Different types of indexes are used depending on the types of applications that use the directory service. Different applications may frequently search for a particular attribute, or may search the directory in a different language, or may require data in a particular format.

6.4.1. Overview of Directory Index Types

Directory Server supports the following types of index:
  • Presence index — Lists entries that possess a particular attribute, such as uid.
  • Equality index — Lists entries that contain a specific attribute value, such as cn=Babs Jensen.
  • Approximate index — Allows approximate (or "sounds-like") searches. For example, an entry might contain the attribute value of cn=Babs L. Jensen. An approximate search would return this value for searches against cn~=Babs Jensen, cn~=Babs, and cn~=Jensen.

    Note

    Approximate indexes require that names be written in English using ASCII characters.
  • Substring index — Allows searches against substrings within entries. For example, a search for cn=*derson would match common names containing this string (such as Bill Anderson, Norma Henderson, and Steve Sanderson).
  • International index — Improves the performance of searches for information in international directories. Configure the index to apply a matching rule by associating a locale (internationalization OID) with the attribute being indexed.
  • Browsing index or virtual list view (VLV) index — Improves the display performance of entries in the Directory Server Console. A browsing index can be created on any branch in the directory tree to improve the display performance.

6.4.2. Evaluating the Costs of Indexing

Indexes improve search performance in the directory databases, but there is a cost involved:
  • Indexes increase the time it takes to modify entries.
    The more indexes being maintained, the longer it takes the directory service to update the database.
  • Index files use disk space.
    The more attributes being indexed, the more files are created. If there are approximate and substring indexes for attributes that contain long strings, these files can grow rapidly.
  • Index files use memory.
    To run more efficiently, the directory service places as many index files in memory as possible. Index files use memory out of the pool available depending upon the database cache size. A large number of index files requires a larger database cache.
  • Index files take time to create.
    Although index files save time during searches, maintaining unnecessary indexes can waste time. Be certain to maintain only the files needed by the client applications using the directory service.