he directory server uses index files to aid in searching the directory. Directory server indexes greatly improve the performance of searches in the directory databases, but they do so at the cost of potentially slower database modification and creation operations. Indexes will also cost more in terms of system resources, especially in disk-space use.
This chapter discusses these index files, how the directory server uses them, and how you manage them. The following topics are covered in this section:
Note
The client may further restrict the number of returned entries by specifying
lower values for the Size Limit in Entries and the Time Limit in Seconds parameters on the search request.
Types of Indexes
To improve searching efficiency, the directory server maintains five distinct types of indexes:
Note
Indexes are contained in files whose names are based on the indexed attribute,
not the type of index contained in the file. In fact, each index file may contain
multiple types of indexes if multiple indexes are maintained for the specific
attribute. For example, all the indexes maintained for the common name
attribute are contained in the
cn.dbb file.
The Presence Index
The presence (pres) index is the simplest of the indexes. It lets you efficiently search the directory for entries that contain a specific attribute. This is useful if, for example, you want to examine any entries that have access control information associated with them. Generating a aci.dbb file that includes a presence index lets you efficiently perform the search for ACI=*.
The Equality Index
The equality (eq) index allows you to efficiently search for entries containing a specific attribute value. For example, an equality index on the cn attribute allows a user to efficiently perform the search for cn=Babs Jensen.
The Approximate Index
The approximate (approx) index allows efficient approximate or "sounds-like" searches. For example, an entry may include the attribute value cn=Robert E Lee. An approximate search would allow a return for searches against cn~=Robert Lee, cn~=Robert, or cn~=Lee. Similarly, a search against l~=San Fransico (note the misspelling) would return entries including l=San Francisco.
The directory server uses a variation of the metaphone phonetic algorithm to perform this type of searching. Each value is treated as a sequence of words, and a phonetic code is generated for each word.
Values entered on an approximate search are similarly translated into a sequence of phonetic codes. An entry is considered to match a query if:
The Substring Index
The substring (sub) index is a costly index to maintain, but it allows for efficient searching against substrings within entries.
For example, searches of the form
cn=*dersonwould match the common names containing strings such as
Bill Andersonand so forth. Similarly, the search for
Jill Anderson
Steve Sanderson
telephonenumber= *555*would return all the entries in your directory with telephone numbers that contain 555.
For more information on creating an international index, see "Creating International Index Entries".
The Cost of Indexing
Although indexes greatly improve the speed of searches within the directory server database, you should be aware of the costs related to indexing:
For example, suppose the directory server is asked to add the entry:
dn: cn=Bill Pumice, ou=People, o=airius.comFurther suppose that the directory server is maintaining:
objectclass: top
objectClass: person
objectClass: orgperson
objectClass: inetorgperson
cn: Bill Pumice
cn: Bill
sn: Pumice
ou: Manufacturing
ou: people
telephonenumber: 408 555 8834
description: Manufacturing lead for the Z238 line.
Higher System Resource Use
One other cost to maintaining index files is the increased system resources they require. Although the impact to your system depends on how large a database you are using and how many attributes exist within your database, consider that:
cn, sn, mail, telephoneNumber
These indexes are added by default to improve the performance of the most common types of user directory searches.
ntUserDomainId attribute. This improves NT Synchronization Service performance. Note that this index has no impact on your directory server's performance if you are not using the NT Synchronization Service.
uid, uniquemember, and member attributes. This is primarily used to improve SuiteSpot performance.
changenumber attribute. This is primarily used to improve replication performance.
Standard Index Files
Because of the need to maintain default indexes and other internal indexing mechanisms, the directory server maintains several standard index files. They are:
id2entry.dbb--contains the actual directory database entries. All other database files can be recreated from this one, if necessary.
id2children.dbb--restricts the scope of one-level searches, that is, searches that examine an entry's immediate children.
dn.dbb--controls the scope of subtree searches; that is, searches that examine an entry and all the entries in the subtree beneath it.
dn2id.dbb--begins all searches efficiently by mapping an entry's distinguished name to its ID number.
If you want to create an index for a language other than english, enter the OID for the collation order you want to use in the Matching Rules field. You can index the attribute using multiple languages by listing multiple OIDs separated by commas (but no whitespace). For a list of languages and their associated OIDs, see Table D.1.
Note that if an index already exists and you just want to add an international OID value to that index, you can do so by adding the appropriate value to that index's Matching Rules field. However, you should then perform the procedure as described in "Indexing Currently Existing Attributes".
Creating Indexes Using slapd.dynamic_ldbm.conf
You can create new indexes from the command line by using the index parameter in slapd.dynamic_ldbm.conf.
Note
You can perform this same operation using
Do the following:
slapd.conf. However, you will
not be able to manage indexes from the server manager that have been added
to slapd.conf directly. For best results, perform these activities in
slapd.dynamic_ldbm.conf.
slapd.dynamic_ldbm.conf (for a description of where the configuration files reside in your directory server installation, see "Finding the Configuration Files").
index parameter of the form:
index <attribute> [<list of indexes>][<list of OIDs>]
pres, eq, sub, and/or approx, and <list of OIDs> is a list of international collation OIDs. Note that if you omit <list of indexes> and instead
you specify just <list of OIDs> you must denote the null list of indexes with
double quotation marks ("").
For example:
index cn,telephoneNumber pres,eq,sub
index cn "" 2.16.840.1.113730.3.3.2.15.1
index cn eq,sub 2.16.840.1.113730.3.3.2.15.1index cn
none to specify that no indexes are to be maintained for the
attribute. For example:
index cn none
default to specify the list of all attributes not otherwise
identified in an index parameter. For example:
index default none
slapd.dynamic_ldbm.conf file, restart the directory server.
Indexing Currently Existing Attributes
If you are adding an attribute that you have never before stored in the database, then you can skip this section because the directory server will automatically generate the appropriate index as you add the new attribute to entries in your database. Simply make sure that you have created the desired index setting before you start using the new attribute with your database.
For details on creating new index settings, refer to either "Creating Indexes from the Server Manager", "Creating Indexes Using slapd.dynamic_ldbm.conf", or "Creating International Index Entries".
If you have created a new index setting for an attribute that your database already uses, then you must reimport your database from LDIF to generate the index for the currently existing attribute. You must do this if you add a new type of index for the currently existing attribute, or if you are adding a new international OID to an existing index. Do the following:
db2ldif to generate the LDIF file, do not specify the -n parameter.
slapd.conf with the new index parameter as described in "Creating Indexes from the Server Manager", or "Creating Indexes Using slapd.dynamic_ldbm.conf".
Creating International Index Entries
You can create international indexes for the locales you support to speed up international searches. The process for creating an international index is similar to the process for creating regular indexes, except that you associate a collation order with the attributes to be indexed.
You can create international indexes by
slapd.dynamic_ldbm.conf
To create an international index from the server manager, do the following:
Creating International Indexes Using slapd.dynamic_ldbm.conf
The directory server generates index entries only when database entries are created or modified. For this reason, the following procedure alone is not enough if you want to create an international index for attributes that already exist in your database. If you want to create an international index for a currently existing attribute, create your new index setting using this procedure, and then use the procedure outlined in "Indexing Currently Existing Attributes".
slapd.dynamic_ldbm.conf (for a description of where the configuration files reside in your directory server installation, see "Finding the Configuration Files").
index <attribute> "" <OIDs>
<attribute> is the attribute to be indexed.
<OIDs> is a comma separated list of the OIDs for the languages in which you want the attribute indexed. For a list of languages and their corresponding OIDs, see Table D.1.
slapd.dynamic_ldbm.conf file:
index "" 2.16.840.1.113730.3.3.2.15.1
Editing an Existing Index Parameter to Add an International Index
To edit an existing index parameter to add a new international index, do the following:
slapd.dynamic_ldbm.conf file (for a description of where the configuration files reside in your directory, see "Finding the Configuration Files").
index cn
slapd.dynamic_ldbm.conf:
index cn eq,sub
index cn eq,sub 2.16.840.1.113730.3.3.2.15.1
Removing Indexes
You can delete some standard indexes and all indexes that you have created as follows:
Removing Standard Indexes
There is a set of standard indexes that you can not delete by using the Database Management | Attribute Indexing form. You can delete these indexes by editing the appropriate configuration file and restarting your server. The exception to this is the presence index for the ACI and copiedFrom attributes. There is no way to remove these indexes from your server.
To delete all other standard indexes from your server (with the exception of the presence index for the ACI and copiedFrom attributes):
slapd.dynamic_ldbm.conf to remove the index. Also, if an index is used by a specific SuiteSpot server (such as Messaging or Calendar server), you must also edit the configuration file that corresponds to that server. These configuration files are named:
<NSHOME>/slapd-<serverID>/config/ns-<server>-
globopt.conf
index cn pres,sub,eq
index cn pres,eq
slapd.dynamic_ldbm.conf and ns-mail-globopt.conf.