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

Explode for sort doesn't work if the index have multi-key path at the end

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

      When analyzing what sort can we provide by exploding an index scan, we return false (so no sorts) if we encounter a multi-key path in the suffix: https://github.com/mongodb/mongo/blob/995d977db8a8542e5ddb2d442882e42f439349c4/src/mongo/db/query/planner_analysis.cpp#L1089

      This return false should be replaced with just break, because if there are regular paths before a multi-key path, we still can provide some kind of sort

        1. repro.js
          0.5 kB
          Ivan Fefer

            Assignee:
            Unassigned Unassigned
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: