Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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:

(|(uid=jdoe)(uid=mdawson)(uid=fwright)...)

Is there a better way?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

http://stackoverflow.com/questions/927499/ldap-query-syntax-to-compare-to-a-list 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

 
discard

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.