KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Query Index Precedence
PRODUCT: 4D | VERSION: 20 R | PLATFORM: Mac & Win
Published On: December 18, 2024

4D tries to optimize queries when possible to improve performance. For the most part, this cannot be controled and is all handled by 4D.

Simple Indexes are the typical Indexes applied to a single field.
Composite Indexes are Indexes applied to a group of 2 or more fields.

How the Indexes are prioritized are as follows:
- Composite Indexes will take precedence over Simple Indexes, IF the Simple Index query is not using an 'equality' (=) or a 'difference' (#) comparator.
- In all other cases there is no way to control the order of Indexes
- If a query is performed in which Composite Indexes and Simple Indexes both use the 'equality' (=) or 'difference' (#) comparators, 4D will use the first one it finds through various uncontrollable criteria in the backend.

As such the only control over the Index order is if a Composite Index is queried with a Simple Index using a comparitor that is not an 'equality' (=) or a 'difference' (#) comparator such as a 'greater than' (>).