Platform SDK: Active Directory, ADSI, and Directory Services

Indexed Attributes

Attributes may be indexed. Indexing an attribute can improve the performance of queries for that attribute.

  1. Attributes are indexed when the searchFlags property in their schema definition has the least significant bit set to "1". Changing the least significant bit of searchFlags to 1 will dynamically build an index; changing it to 0 will drop an index for the attribute in question. The index will be built automatically by a background thread on the DC.
  2. Ideally indexed properties should be single valued with highly unique values evenly distributed across the set of instances. The less unique the values of an attribute are, the less effective the index will be.
  3. Multi-valued properties can also be indexed although the cost to build the index is larger in terms of storage, update, and search time. The uniqueness requirement for a multi-valued property is the same as that for a single-valued property: the more unique the values are the more effective the index.
  4. The more indexed attributes a class has, the longer it takes to create new instances of the class.

Indexes apply to attributes, not to classes. That is, when you mark an attribute as indexed, all instances of the attribute are added to the index, not just the instances that are members of a particular class.

To verify that a server is using an index to process your application's queries, set the registry key "HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Services\NTDS\Diagnostics\ 9 Internal Processing" to the value 4 on a domain controller. Then perform a query on that DC and look in the directory event log for information on the indexes if any that were used to process the query.

For a description of the other bits in the searchFlags property, see Characteristics of Attributes.