Fix perf regression due to early fetching of index matches

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • QE 2026-06-22, QE 2026-07-06
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When a $lookup is using the index strategy, the index fetching code is doing the seek-deduplicate-fetch loop in the leaf node of the plan, but above this section there is a loop over all the possible search keys that belong to the same outer document. This loop performs a second deduplicate check to remove identical foreign documents matching different parts of the same local document. The result is correct, but we end up re-fetching documents that are later discarded.

      Option 1: delay fetching, but this would imply delaying also the filtering and any manipulation done in the subpipeline representing the foreign stream

      Option 2: switch to a more complex index scan representation that receives the entire set of search keys

            Assignee:
            Alberto Massari
            Reporter:
            Alberto Massari
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: