-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
ALL
During planning for time-series collections to enable more queries to run with the bounded sort optimization, we pass a traversal preference to the planner. This traversal preference reverses the sort pattern in the original query so we can attempt to plan a backward index scan. Therefore we expect a plan to be generated that has a reversed sort direction when only the backwards index scan satisfies the sort order. This code was introduced in SERVER-64994. However, the function that checks if such a plan can be generated (sortMatchesTraversalPreference) always returns false for compound time-series indexes and sort predicates. I noticed this during a help ticket investigation (fixing this won’t completely solve the customer’s problem).
I think this is happening because sortMatchesTraversalPreference will always return false if the field name in the sort pattern doesn’t match the field name in the index pattern. For time-series the index pattern in this function intentionally ignores the meta fields, but the sort pattern does not, so the field names will never match. I didn’t complete a full investigation though. This is blocking plans from using the bounded sort optimization.
Reproducible is in the comments.
- is related to
-
SERVER-64994 Extend the planner to allow soft hints about index traversal direction for predicate satisfaction
-
- Closed
-