Title: LDAP Query Question
I wholeheartedly agree with point 2.
 
I will look at doing STATS in ADFIND in the next rev or two.  Give me a month, maybe two. Just starting to see the light of day again. :o)
 
   joe


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Fleischman
Sent: Wednesday, April 21, 2004 10:28 AM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] LDAP Query Question

1)       It should process objectcategory which is why I said I think perf gain should be small.

2)       Right, expensive on insert. My comment was only that indexes need be considered before being just flipped on. If you flip on an index for a once-a-year query, that’s not your best use of resources….you’re better off taking the somewhat larger perf hit there than you are taking the small perf hit every day for the whole year.
No further tuple index docs that I’m aware of.

3)       Umm, I’d say don’t parse the STATS output, just dump it. I can’t imagine parsing is going to help…..STATS output tends to be one of those things that if you can read it, great….but if not, parsing isn’t going to help much. :)

4)       Good question. I assume this is a subtree search?
Show me some stats spew and I can answer for sure, but if forced to guess, I’d guess the second one is faster, but not by much. At least that is my hunch. We can’t do a ton to optimize those two last terms short of possibly reordering a bit, but that won’t buy us anything huge. We can’t drop a term, we can’t simplify the logic and we can’t hit any extra indexes through optimization that I can think of.
I don’t have a good data set on a local DC here, but if you do, run these and get me STATS spew on em both. I’ll be able to see if I’m right about that.
J

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of joe
Sent: Wednesday, April 21, 2004 6:47 AM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] LDAP Query Question

 

1. I would tend to agree that the poerf difference should be small on this one, that is why I said may or may not get a performance gain, it really depends on how AD optimizes the query. I would hope it was smart enough to process the indexed pieces first and then use the non-indexed pieces. At that point, the subset needed to be gone over for non-indexed checks should be small, but I could be wrong in my guess (too generous) on how the optimizer is working.

 

2. When you say expensive, I guess you mean expensive on the insert operations, they shouldn't have to be touched other than on an update or a new add correct? Just day to day unless you are writing and rewriting an attribute it shouldn't be an issue and if you are constantly rewriting an attrib there is question as to whether or not it should be in an LDAP Store anyway. Is there further docs on tuple indices, there is so little MS documentation that I have ever found.

 

3. Thanks on the STATS output stuff. I haven't even looked at it yet but from what I have seen in Docs, the output doesn't seem to be heavily documented which makes me think I will have to be careful in my parsing of it. I have to really look to see if I need to restructure anything yet in the main code body.

 

4. Eric, which version of the query in 3 should be more efficient based on your knowledge of the optimizer?

 

-------------

http://www.joeware.net   (download joeware)

http://www.cafeshops.com/joewarenet  (wear joeware)

 

 

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Fleischman
Sent: Tuesday, April 20, 2004 11:31 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] LDAP Query Question

A few things inline (in red)

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of joe
Sent: Tuesday, April 20, 2004 8:30 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] LDAP Query Question

 

A couple of things

 

1. You don't really need objectclass for this query. You may or may not get a performance gain for removing it.
[EFLEIS] – perf win here should be small if you made me guess. If it is large, let me know, I’d be curious to investigate why. With STATS output I could probably answer the question.

2. You don't mention anything around the *SMS* part of the query.. if you don't need it, dump it, it will be the slowest part of your query unless you have tuple (medial) indices (not a default).
[EFLEIS] – Tuple indexes are seriously expensive…..I’d rather take the perf hit unless you’re really going to be working this box with that query over and over. Remember, perf gain of an index need outweight perf loss in maintaining that index over the long haul. Else it isn’t worth using that index.

3. The (!(samccountname=_*)(samaccountname=\2a*)(samaccountname=*SMS*)) isn't really doing what I think you expect. I think you expect it would NOT all of those items. It probably should NOT the first item and OR in the rest and then ORed in all of them together.

 

For your original problem statement I think I would do something like

 

(&(objectcategory=person)(|(!(sAMAccountName=_*))(!(sAMAccountName=\2a*)))

 

Not really sure if that or (&(objectcategory=person)(!(|(sAMAccountName=_*)(sAMAccountName=\2a*)))) would be faster. Best would be to test them both, maybe use the STATS control (yes I have to add that one to ADFIND) or turn on the ldap query logging on the DCs to see how they show up in terms of efficiency.

[EFLEIS] – If you need help understanding the STATS output just holler. And yes it should be exposed in adfind, although I’ve still never used adfind, but it sounds useful.

Oh, and the comment about logging and STATS…..yea, mostly useful if running 2k03 which you didn’t mention. If not 2k03 you won’t get as much spew from the logging options and such.

 

 

   joe

 

 

-------------

http://www.joeware.net   (download joeware)

http://www.cafeshops.com/joewarenet  (wear joeware)

 

 

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Monday, April 19, 2004 3:06 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] LDAP Query Question

Hey folks,

I’m trying to write an LDAP query to return the users that don’t begin with two different characters, either an underscore (_) or an asterisk (*).  I’ve searched the archives… so forgive me if this is a repeat.  J

(&

(objectcategory=person)

(objectclass=user)

(|

                        (!

                                    (sAMAccountName=_*)

                                    (sAMAccountName=\2a*)

                                    (sAMAccountName=*SMS*)

                        )

            )

)

 

Any suggestions?  J  Thanks!

Reply via email to