You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for reporting this issue.
Currently the optimizer will pick indexes based on how many attributes of the FILTER / SORT conditions are covered by an index, how selective an index is, and how many attributes it covers.
Unfortunately the stored values of an index are currently not taken into account during index selection. The same is true for attributes of documents that are used outside of FILTER / SORT conditions, which may be covered by indexes as well.
Right now the only workaround in this case is to manually add an index hint to the query as you did. Longer term, the optimizer will need to be changed so that it will also take into account which attributes of the collection/indexes are using by the query besides in the FILTER / SORT conditions.
dothebart
changed the title
optimizer chooses multiple field index instead of single field index (+ stored values) because of selectivity
optimizer should consider projections and stored values when selecting indexes
May 14, 2024
My Environment
Component, Query & Data
Affected feature:
index selection when executing a query
AQL query (if applicable):
29.969 s
572.090 ms
AQL explain and/or profile (if applicable):
Dataset:
Size of your Dataset on disk:
600GB
Replication Factor & Number of Shards (Cluster only):
Steps to reproduce
indexHint
indexHint
Problem:
The automatic choice of index (based on selectivity?) results in very poor performance for this query.
As the default chosen index is based on 2 fields, the selectivity does not seem to be good if a filter is applied on only 1 of the 2 fields.
The index we force has less selectivity, but it also has stored values, and the performance is really better (29s vs. 0.5s).
Expected result:
We expect the selected index to match both the filters applied and the return statement (stored values).
The text was updated successfully, but these errors were encountered: