Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-92938

Allow $match move before stages that do not rename or modify any paths

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization

      Investigate if we can always move $match stages ahead of stages that do not modify or rename any paths (getModifiedPaths() == {DocumentSource::GetModPathsReturn::Type::kFiniteSet, {}, {}}) (4 stages) and have canSwapWithMatch == true (15 stages).

      Currently, this decision depends on the result of the hasOnlyRenameableMatchExpressionChildren() function which examines the content of a $mach stage and might return false, in which case the $match stage will not be moved. SERVER-73914 decreased the number of such expressions and more expressions are to be addressed with SERVER-55492, however, it is not clear if this is necessary when the modified paths by the previous stage are empty.

      If we can always move $match ahead of stages that do not modify any paths, we should remove the workaround introduced by SERVER-91406.

            Assignee:
            Unassigned Unassigned
            Reporter:
            romans.kasperovics@mongodb.com Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: