Directory Server uses indexes to speed up search operations by associating lookup information with Directory Server entries. During a search operation, Directory Server uses the index to find entries that match the search key . Without an index, Directory Server must check every entry in a suffix to find matches for the search key.
Indexes are stored in database files, and are created and managed independently for each suffix in a directory. Each index file contains all of the indexes defined in the suffix for a given attribute. For example, all indexes maintained for the cn attribute are stored in the databaseName_cn.db3 file. When an indexed entry is modified, Directory Server updates the index files.
Directory Server supports the following types of indexes:
Default indexes to improve search performance or support searches performed by other applications. Default indexes are added when a suffix is created.
System indexes to help Directory Server to function properly and efficiently.
User indexes, added when a user creates an attribute or defines a new index.
The use of indexes can enhance performance by reducing the time taken to perform a search. However, indexes also have an associated cost. When an entry is updated, the indexes referring to that entry must also be updated. The more an entry is indexed, the more resources are required to update the index; indexes take up disk space and memory space.
When you design indexes, ensure that you offset the benefit of faster searches against the associated costs of the index. Maintaining useful indexes is good practice; maintaining unused indexes for attributes on which clients rarely search is wasteful.
You can optimize performance of searches in the following ways:
By preventing Directory Server from performing searches on non-indexed entries
By limiting the length of an index list
By ensuring that the size of a data base cache is appropriately tuned
To prevent Directory Server from performing searches on non-indexed entries, set the require-index-enabled suffix property for the suffix.
To limit the number of values per index key for a given search you can set an index list threshold. If the number of entries in the list for a search key exceeds the index list threshold, an unindexed search is performed. The threshold can be set for an entire server instance, for an entire suffix, and for an individual attribute type. You can also set individual thresholds for equality, presence, and substring indexes.
For a detailed procedure on how to change the index list threshold, seeChanging the Index List Threshold in Sun Java System Directory Server Enterprise Edition 6.2 Administration Guide. This procedure modifies the all-ids-threshold configuration property.
The global value of all-ids-threshold for the server instance should be about 5% of the total number of entries in the directory. For example, the default value of 4000 is generally right for instances of Directory Server that handle 80 000 entries or less. You should avoid setting the threshold above 50 000, even for very large deployments. However, you might set all-ids-threshold to a value other than the 5% guideline in the following situations:
You expect the directory to grow considerably and wish to set the threshold higher than 5 percent of the total.
You have consumers that support many searches and masters that support mostly writes, and you wish to set a different threshold for consumers and masters.
You plan to initialize a large directory from an LDIF file and you wish to change the threshold just before initialization.
Your directory has a deeply hierarchical directory information tree, and you are running one–level or subtree searches. In this case you could set the all-ids-threshold high for parent and ancestor indexes so that all entries below a given branch are indexed.
You should limit the number of unindexed searches that are performed. Use the logconv utility provided with the Directory Server Resource Kit to examine the access logs for evidence of frequent unindexed searches. For more information, see the logconv(1) man page.