Consider the following performance enhancement concepts when
executing a query:
If possible, search for indexed attributes only. Use index
attributes that you expect will generate the fewest number of hits.
Be aware that a comprehensive list of indexed attributes for
Windows 2000 and Windows Server 2003 can be found in the
Active Directory Schema section of the Active Directory guide.
Search on objectCategory instead of objectClass
because objectClass is not an indexed property.
Be aware of referrals. Consider searching the global catalog if
your attributes are listed as GC replicated.
Avoid searching for text in the middle and at the end of a
string. For example, "cn=*hille*" or "cn=*larouse".
Assume that a subtree search will return a large result set.
Use paging when performing subtree searches. The server will then
be able to stream a large result set in chunks reducing the
server-side memory resources. This effectively flattens out network
usage and reduces the need for sending extremely large chunks of
data over the network.
Properly scope your searches so as to not retrieve more than is
necessary.
Perform a complex search on multiple attributes, because it is
less performance intensive than performing multiple searches. One
search for an object that reads two attributes is more efficient
than two searches for the same object, each returning one
attribute.
For reading group memberships, use range limits to minimize the
search size so that you can read a few thousand members at a
time.
Bind to an object once and hang onto the binding handle for the
remainder of your session. Do not bind and unbind for each call. If
you are using ADO or OLE DB, do not create many connection
objects.
Read the rootDSE once and remember its contents for the rest of
your session.