-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
RelevantTag appears to be used by the query planner to tag MatchExpression nodes with indexes that are useful for satisfying a predicate. The plan enumerator then uses these tags to generate MatchExpressions labeled with IndexTag, which are the final index labels that tell us what indexes will be used where, so we can construct a QuerySolution.
The documentation around these MatchExpression tag classes is minimal. For example in RelevantTag, first and notFirst are essential fields that pass some information (I'm not sure what exactly) to the plan enumerator about how the indexes can be used. There's also no comment on the MatchExpression tag field or the TagData base class.
Since these structures are core components of the optimizer, we should add more comments around this area.