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

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

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

      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@mongodb.com Mindaugas Malinauskas
            Reporter:
            christopher.harris@mongodb.com Chris Harris
            Votes:
            1 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: