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

Index substring min length 3?



We have finally entered the 21st century by upgrading from OpenLDAP 1.2.13 to 2.0.27. Platform is RedHat 7.3, minimal changes to the latest errata they've packaged. ldbm backend, gdbm libs.

Problem:

Under openldap 1.2.13, we were able to get indexed searches on 3-character substrings with acceptable performance. For example,

ldapsearch 'cn=*esz*'

would return the 4 matching people instantly. Under openldap 2.0.27, the same search takes about 10 seconds.

Index specifications are the same in either case,

index cn pres,eq,sub

The cutoff seems to be 3 characters. 4-character search terms, and initial/final searches (presumably the boundary is a 4th character), are speedy as ever.

In servers/slapd/slap.h I have found

#define SLAP_INDEX_SUBSTR_MINLEN        2
#define SLAP_INDEX_SUBSTR_MAXLEN        4

but my limited understanding doesn't read that as a magic number of 3 characters for a full table scan. Do I want to fiddle these defines, or am I on the wrong track.

I have mitigated the impact by rewriting our web/finger interfaces to change the filter specs from cn=*%s%* to exact sn or initial/final anchored cn searches, but I'd prefer to understand where the problem is, and either fix it or be talked out of allowing 3-character substring indexes because it's a silly thing to do.

We only have a total 9000 directory entries, so our indexes are not outrageously large. Tuningwise, I've settled on

dbsync          10
cachesize       2000
dbcachesize     1500000

which gives us a RSS of about 100MB.
--
Rich Graves <rcgraves@brandeis.edu>
UNet Systems Administrator