Support $lookup sub-pipelines with $match only in join optimizer

XMLWordPrintableJSON

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

      Aggregation pipeline's get_executor relies currently on collection's pointers stored in MultipleCollectionAccessor. The class stores collection info for the main collection and for the foreign collections. In case of $lookup with subpipelines we don't push down to CanonicalQuery and, therefore, don't add its foreign namespace to the list of foreign namespaces of the pipeline.

      This approach does not work with join plans where we create a CanonicalQuery for every collection participating in the join graph even its corresponding $lookup contains a subpipeline.

      One possible solution could be just remove if (getSubPipelines().empty()) condition and always add lookup's foreign namespaces. However, it can have a potential negative performance impact.

      Another solution is to use `getInvolvedNamespaces()` to build MultipleCollectionAccessor.

      The third solution is to build MultipleCollectionAccessor for every CanonicalQuery in the join graph.

            Assignee:
            Alya Berciu
            Reporter:
            Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: