King Chan
King Chan

Reputation: 4302

Which filter is faster to search all User in LDAP?

I have this:

(&(objectCategory=person)(objectClass=user))

And this:

(&(objectCategory=user)(samaccountname=*))

Which one will be faster? I am not so familiar with Active Directory architecture...

Upvotes: 2

Views: 2550

Answers (2)

jwilleke
jwilleke

Reputation: 11036

As mentioned, there are a lot of server conditions that can play into the results as far as performance.

Also depends on what type of entries you wish to return. As you are using Active Directory you should try one of these:

All users:

(&(objectCategory=person)(objectClass=user))

or (We usually see this as faster)

(sAMAccountType=805306368)

All contacts:

(objectClass=contact)

All users and contacts:

(objectClass=user)

-jim

Upvotes: 1

Terry Gardner
Terry Gardner

Reputation: 11132

It depends on the server. If objectCategory has an equality index and objectClass has an equality index and samAccountName has a present index, then the number of entries returned and the number of bytes per entry (as dictated by the requested attributes) will count towards the cost of fulfilling the search.

Upvotes: 1

Related Questions