Bug 53259 - index: Review / discuss what LDAP indices we need
Summary: index: Review / discuss what LDAP indices we need
Status: NEW
Alias: None
Product: UCS
Classification: Unclassified
Component: LDAP
Version: UCS 5.0
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: UCS maintainers
QA Contact: UCS maintainers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-14 10:51 CEST by Jürn Brodersen
Modified: 2025-10-14 09:39 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2021-05-14 10:51:19 CEST
Review / discuss what LDAP indices we need

For bug 53191 we decided against adding attributes which produced the "not indexed" warning.

To many indices can slow down the LDAP server performance:

- https://unix.stackexchange.com/questions/451118/openldap-bdb-equality-candidates-memberof-not-indexed
As i understand this, every index produces search candidates e.g. "(&(univentionObjectType=users/user)(uid=foo))" one big set of candidates for "univentionObjectType" and a small one for "uid". This is slower than just having an index for "uid"

50000 users -> 2.9ms for both indices, 2.7ms only for uid as an index.

- Write operations need to update indices
Time to delete a user in a domain with 50000 users
98ms default ucs indices
31ms only uid + objectClass as indices


Looking at the numbers above, generally it still seems to be the right approach to add an index, since searches can be magnitudes slower without an index.
Comment 1 Philipp Hahn univentionstaff 2024-04-16 17:49:12 CEST
There's a maximum number for indices in OpenLDAP:
  servers/slapd/back-mdb/back-mdb.h:45
  > #define MDB_INDICES»»···256
Comment 2 Philipp Hahn univentionstaff 2024-05-17 10:59:32 CEST
There is a large list of attributes, which are missing; see <https://git.knut.univention.de/univention/ucs/-/blob/5.2-0/test/ucs-test/tests/99_end/06_ldap-index-missing?ref_type=heads>
Comment 4 Jürn Brodersen univentionstaff 2025-07-02 10:34:04 CEST
(In reply to Philipp Hahn from comment #1)
> There's a maximum number for indices in OpenLDAP:
>   servers/slapd/back-mdb/back-mdb.h:45
>   > #define MDB_INDICES»»···256

UCS 5.2 is using openldap 2.5.13, which is still set to only 128 indices

https://git.openldap.org/openldap/openldap/-/blob/OPENLDAP_REL_ENG_2_5_13/servers/slapd/back-mdb/back-mdb.h?ref_type=tags#L44
Comment 5 Jürn Brodersen univentionstaff 2025-10-14 09:39:17 CEST
Note:

We increased the number of indexes with a patch in our openldap build to 256.
See https://forge.univention.org/bugzilla/show_bug.cgi?id=58443(In reply to Jürn Brodersen from comment #4)
> (In reply to Philipp Hahn from comment #1)
> > There's a maximum number for indices in OpenLDAP:
> >   servers/slapd/back-mdb/back-mdb.h:45
> >   > #define MDB_INDICES»»···256
> 
> UCS 5.2 is using openldap 2.5.13, which is still set to only 128 indices
> 
> https://git.openldap.org/openldap/openldap/-/blob/OPENLDAP_REL_ENG_2_5_13/
> servers/slapd/back-mdb/back-mdb.h?ref_type=tags#L44

Note:

We increased the number of indexes with a patch in our openldap build to 256.
See https://forge.univention.org/bugzilla/show_bug.cgi?id=58443