This topic has not yet been rated - Rate this topic

What Makes a Fast Query?

Consider the following performance enhancement concepts when executing a query:

  • If possible, filter on indexed attributes only. Use index attributes that you expect will generate the fewest number of hits. For more information and a comprehensive list of indexed attributes for Windows 2000 and Windows Server 2003, see Active Directory Schema.
  • 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 attribute with a large number of values, use range limits to minimize the search size so that you can read a few thousand members at a time. For more information about specifying attribute range limits, see Attribute Range Retrieval.
  • Bind to an object hold 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 remainder of your session.

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Order of magnitude please
The above text suggests keeping connections open once they are made, yet it also states "do not create many connection objects." How many objects would be many. 10, 100, 1000, 10000, etc. Some general guideline with this would be useful.
objectClass indexed by default in Windows Server 2008 and Exchange 2007 Schema mods
When updating your Active Directory Schema to prepare for Server 2008 and Exchange 2007, objectClass gets indexed automatically (even if it wasn't indexed before). This is new and the article above doesn't state so.