Show Table of Contents
Chapter 4. Improving Search Performance (and Balancing Read Performance)
The most effective way to improve search operations against the directory is to configure thorough indexes for entries, combined with reasonable limits on search results.
4.1. Using Indexes
An index (as it implies) is a tag that shows that a certain entry contains a certain attribute, without having to contain any other detail about the entry (which saves space and makes returning search results faster). Each index is organized around a Directory Server attribute and a certain way of matching that attribute:
- Presence index (pres) simply shows what entries contain an attribute.
- Equality index (eq) shows which attribute values match a specific search string.
- Approximate index (approx) is used for efficient sounds-like searches, which shows entries which have a value that phonetically matches a string.
- Substring index (sub) matches any substring of an attribute value to the given search string. (This index if very expensive for the server to maintain.)
- International index uses a matching rule to match strings in a directory which contains values in languages other than English.
- Browsing index, or virtual list view (VLV) index, sets an index to use to display entries in the Directory Server Console.
Note
Indexing is described in much more detail in the Administration Guide.
However, just creating indexes is not ipso facto going to increase server performance. Maintaining indexes puts a burden on the Directory Server for every modify, add, and delete operation by having to verify every attribute in the change against every index maintained by the server:
- The Directory Server receives an add or modify operation.
- The Directory Server examines the indexing attributes to determine whether an index is maintained for the attribute values.
- If the created attribute values are indexed, then the Directory Server generates the new index entries.
- Once the server completes the indexing, the actual attribute values are created according to the client request.
For example, the Directory Server adds the entry:
dn: cn=John Doe, ou=People,dc=example,dc=com objectclass: top objectClass: person objectClass: orgperson objectClass: inetorgperson cn: John Doe cn: John sn: Doe ou: Manufacturing ou: people telephoneNumber: 408 555 8834 description: Manufacturing lead for the Z238 line of widgets.
The Directory Server is maintaining the following indexes:
- Equality, approximate, and substring indexes for
cn(common name) andsn(surname) attributes. - Equality and substring indexes for the telephone number attribute.
- Substring indexes for the description attribute.
When adding that entry to the directory, the Directory Server must perform these steps:
- Create the
cnequality index entry forJohnandJohn Doe. - Create the appropriate
cnapproximate index entries forJohnandJohn Doe. - Create the appropriate
cnsubstring index entries forJohnandJohn Doe. - Create the
snequality index entry forDoe. - Create the appropriate
snapproximate index entry forDoe. - Create the appropriate
snsubstring index entries forDoe. - Create the telephone number equality index entry for
408 555 8834. - Create the appropriate telephone number substring index entries for
408 555 8834. - Create the appropriate description substring index entries for
Manufacturing lead for the Z238 line of widgets. A large number of substring entries are generated for this string.
Before creating new indexes, make sure to balance the overhead of maintaining the indexes against the potential improvements in search performance. Especially important, match the types of indexes that you maintain to the type of information stored in the directory and the type of information users routinely search for.
- Approximate indexes are not efficient for attributes commonly containing numbers, such as telephone numbers.
- Substring indexes do not work for binary attributes.
- Equality indexes should be avoided if the value is big (such as attributes intended to contain photographs or passwords containing encrypted data).
- Maintaining indexes for attributes not commonly used in a search increases overhead without improving global searching performance.
- Attributes that are not indexed can still be specified in search requests, although the search performance may be degraded significantly, depending on the type of search.
- The more indexes you maintain, the more disk space you require.
Note
Creating indexes is much more effective for directories which have a high search operation load and low modify operation load.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.