Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of UIDs - let's say around 200. What is the most efficient way to retrieve all their LDAP records?

The first thing that comes to mind is a query that's a big chain of ORs:


Is there a better way?

share|improve this question
up vote 2 down vote accepted suggests the OR is the only way to do it.

share|improve this answer

It depends on what object properties you're retrieving and the locality of the LDAP server. I've found it faster at times (depending on circumstances) to just grab everything, store it locally in a cache, and then search the local cache for what I want.

200 records is really not very many; I'm wondering are you optimizing something that doesn't need to be optimized?

share|improve this answer
I don't know if it would be a good idea to locally cache about 6000 users. For whatever reason, large "or" queries are taking about 45% as long as querying individually, so the improvement is valuable, i.e. 4 seconds instead of 10 seconds for 250 users. I'd still like it to be faster... – Joshua Swink Oct 26 '09 at 1:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.