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

Re: SQL backend SELECT problem (1=1 causes horrible performance)



>> If you're using OpenLDAP 2.3 that's correct.  Previous versions
>> always used '1=1' to indicate TRUE.
>
> I'm using 2.2.23 (from Debian Sarge)
>
> Does this mean I could be in luck and that the 1=1 could be from
> something else?  :)

No, you got no luck; in OpenLDAP 2.2, all cases when TRUE is asserted 1=1
is used, so it's not easy to spot what feature required that filter to
expand in the query you reported.  I suggest you try with OpenLDAP 2.3 and
see what filter gets built.  I suspect something like attribute
inheritance.

>
>>
>> The bottom line for a search whose filter contains extended match
>> with the "dn" field set consists in searching the entire database.
>> It would be interesting to see what request gets to slapd.  Can you
>> provide logs of the server at "stats" level?
>
>
> The search reported by slapd -d 1 is:
> ==>backsql_search(): base="ou=contacts,dc=evalesco,dc=com",
>  filter="(|(mail=*foo@*)(displayName=*foo@*)(givenName=*foo@*)
>          (sn=*foo@*))", scope=2, deref=0, attrsonly=0,
>  attributes to load: custom list
>
> If I submit a slightly simpler query using ldapsearch, I get the correct
> simple SQL statement produced, and slapd -d 1 reports:
>
> ==>backsql_search(): base="ou=contacts,dc=evalesco,dc=com",
>  filter="(mail=elite@*)", scope=2, deref=0, attrsonly=0,
>  attributes to load: all
>
> The obvious difference between the two, being that Thunderbird submits a
> "custom list" of attributes to load, while my ldapsearch just requests
> everything.  Could that difference cause 1=1 to be inserted?

I have no idea right now; I don't think so.  I have no chances to
reproduce it here now; I might be able to have a look at it later.

> Sorry for asking, but I am no OpenLDAP core guru;
> Is the "attributes to load" in the above examples what you are referring
> to here?

No , just don't mind.  It's clear here that no extended match is taking
place.

p.



Ing. Pierangelo Masarati
Responsabile Open Solution
OpenLDAP Core Team

SysNet s.n.c.
Via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
------------------------------------------
Office:   +39.02.23998309          
Mobile:   +39.333.4963172
Email:    pierangelo.masarati@sys-net.it
------------------------------------------