[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: optimizing back-sql for naming attribute search



This wipes a lot of generality out of back-sql. How can you tell that the filter is using the naming attribute of the entry you're searching? You can well define one person's DN to be "uid=someone,dc=your,dc=naming,dc=ctx" and another one's to be "cn=Someone Else,ou=People,dc=your,dc=naming,dc=ctx". You can even modrdn one AFTER it was created, so you shouldn't trust your unique entry point, if any, for entry creation. If performances are your main issue, in my opinion you shouldn't be using back-sql at all. Why don't you try using proxy caching, then? That really boosts back-sql performances... slapo-pcache(5) and test020 for details.

p.

Brad Midgley wrote:

Hi

If I do the most common type of search, by naming attribute:

ldapsearch -H ldaps://iceman.uen.org -D uid=bmidgley,dc=my,dc=uen,dc=org -x -W -d 256 -z 10 "(uid=bmidgley)"

The join between ldap_entries (a view with some filtering logic) and our educator table ends up being quite expensive. Would it be pretty safe to avoid the join since the naming attribute is in the dn? Does it seem a little strange to have the naming attribute there in the dn and also spelled out inside ldap_attr_mappings?

The difference in search times goes from about 14 seconds to 2 seconds on our devel sql server. The new search should be under 1s on the production server.

So here's the current generated search... uid gets mapped to username inside educator:

SELECT DISTINCT ldap_entries.id,utahlink..educator.teacher_id,('inetOrgPerson') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,utahlink..educator WHERE utahlink..educator.teacher_id=ldap_entries.keyval AND ldap_entries.oc_map_id=1 AND upper(ldap_entries.dn) LIKE '%DC=MY,DC=UEN,DC=ORG' AND (upper(username)='BMIDGLEY')

And this is what I am thinking I could recode back-sql to generate when it notices the search is on the naming attr:

SELECT DISTINCT ldap_entries.id,
   ldap_entries.keyval,
   ('inetOrgPerson') AS objectClass,
   ldap_entries.dn AS dn
   FROM ldap_entries
   WHERE ldap_entries.oc_map_id = 1
     AND UPPER(ldap_entries.dn) = 'UID=BMIDGLEY,DC=MY,DC=UEN,DC=ORG'

Would that be generally useful?

Brad






   SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497