LDAP Indexing
Just like relational databases, LDAP directories can benefit greatly from proper indexing. Frequently used attributes should have appropriate indexes, but indexing infrequently used attributes results in slower updates and greater disk usage.
A few months ago, I wrote a perl script that parses an OpenLDAP log and reports the type of index that would have been used for each attributed queried. I have now uploaded the script and examples of its output.
I have named the script parse_filters.pl (download script). It can produce output in two formats: HTML
and CSV. Running the script without any options will print a usage statement.
To use this script, loglevel 256 must be enabled in slapd.conf. If you haven't already done so, don't forget to add an entry like "local4.* -/var/log/ldap.log" to your syslog.conf and restart syslog. Because loglevel 256 results in logging of every query performed, I recommend leaving it enabled only long enough to collect statistics and optomize indexing. If you plan on leaving logging enabled long term, I recommend adding a custom logrotate rule.