Allow SORT_MERGE plans even if some children are FETCH stages rather than IXSCAN stages

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Query 2020-08-24
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Currently the planner only considers an OR plan eligible for explodeForSort() if its children are all IXSCANs. In theory a FETCH shouldn’t prevent a SORT_MERGE plan from being eligible.

      The attached explain from 3.2.4 seems to demonstrate the problem. Rather than leveraging the index to create a SORT_MERGE plan, a SORT plan is generated as a result of the FETCH required to satisfy the {$exists:false} filter.

        1. explain.txt
          11 kB
        2. server-25782
          9 kB

            Assignee:
            Mindaugas Malinauskas
            Reporter:
            Chris Harris
            Votes:
            1 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: