Monday Aug 06, 2012

Indexes are files
that contain lists of values, where each value is associated with a list
of entry identifiers to suffixes in the directory server database. When the directory
server processes a search request, it searches the database using the list of
entry identifiers in the indexes, thus speeding up the search. If indexes did
not exist, the directory server would have to look up each entry in
the database, which dramatically degrades performance.

First of all, unindexed searches are rejected by default unless the (authenticated) user has the privilege to perform them because unindexed searches may negatively impact overall directory performances. In some circumstances, unindexed searches are a valid approach, so it is possible to explicitely assign the unindexed-search privilege to a user or a group of user. A user attempting to perform an unindexed search gets the message "you do not have sufficient privileges to perform an unindexed search".

Note that unindexed searches always complete sucessfully when the amount of entries in the database does not exceed the value if index-entry-limit (4000 by default), which is unlikely to be seen in real deployments.

The verify-index command can be used to check the consistency between the index
and entry data within the directory server database. This command also provides information
about the number of index keys that have reached the index entry limit (See below).

The rebuild-index command can be used to rebuild an index. It is useful in the following cases:

When the index-entry-limit property of an index changes

When a new index is created

The index-entry-limit tuning parameter (known as AllIDs threshold in Oracle Directory Server Entreprise Edition) controls the maximum numbers of entries kept in an index record as scaning the whole database may become a more efficient option when the number of entries associated with a given index value becomes huge.

Tuning indexes upfront may not be an obvious task, that's the reason why OUD provides you with both static and dynamic index analyser tools:

The static analyser is delivered as part of the dbtest tool. The dbtest list-index-status -n <dbName> -b <dbSuffix>command let you figure out how many entries are associated with each index value, and tune index-entry-limit when needed..

The dynamic analyser can be used to monitor live search filters received by OUD and corresponding index usage: Live index analysis must be first enabled at the database level. At that point, subsequent searches hitting OUD are analysed and the corresponding statistics are kept in memory. Statistics can be retrieved from the in-memory suffix cn=monitor as part of the database environmenent entry.

Important note: It is not recommanded to enable statistic collection in a production system for a long time as it consumes ressources.

It is also possible to use the operational attribute debugsearchindex to figure out which entries are targetted by each component of a LDAP search filter. This is a lightweight yet convenient way to debug index-related issues.

About

I am Sylvain Duloutre, I work as a Software Architect in the Oracle Directory Integration Team, the customer-facing part of Directory Services & Identity Management Product Development, working on Technical Field Enablement.

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.