The queries that are performed with the LDAP SDK must be structured in an optimal way to ensure good performance. This structuring should place filter terms that return fewest results at the front front of the query and elements that return more results at the end.
In the case of a CTS Query like the CTS Reaper this looks as follows:
The elements of the query are:
Currently the CTS is not correctly ordering these queries to be optimal. As a result we run the risk of exceeding two separate limits:
- size-limit: The maximum number of entries that can be returned in a query
- lookthrough-limit: The maximum number of entries that can be searched through to build up the results of a query.
The recommendation is therefore to reverse all CTS queries and better would be to improve the CTS API so that it automatically refactors queries to move known search terms to the end of the query to ensure performant queries.