Skip to content

Commit 33d4a9c

Browse files
(DOCSP-35695): Update optimization info for lookup (#5857) (#5868)
* (DOCSP-35695): Update optimization info for lookup * consistency * wording * edits * review edit * tech review edits
1 parent 1869efa commit 33d4a9c

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

source/reference/operator/aggregation/lookup.txt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,22 +468,29 @@ different ``$lookup`` operations.
468468

469469
- ``$lookup`` operations that perform equality matches with a
470470
single join typically perform better when the source collection
471-
contains an index on the ``foreignField``.
471+
contains an index on the ``localField``.
472472

473-
* - :ref:`Uncorrelated Subqueries<lookup-uncorrelated-subquery>`
473+
- An index on the ``foreignField`` in the foreign collection
474+
cannot support an equality match with a single join.
474475

475-
- .. _uncorrelated-subqueries-performance:
476+
* - :ref:`Uncorrelated Subqueries <lookup-uncorrelated-subquery>`
476477

477-
- ``$lookup`` operations that contain uncorrelated subqueries
478-
typically perform better when the inner pipeline can reference
479-
an index on the ``foreignField``.
478+
- .. _uncorrelated-subqueries-performance:
479+
480+
- An index on the foreign collection cannot support uncorrelated
481+
subqueries.
482+
483+
- To improve performance for uncorrelated subqueries, use generic
484+
indexing strategies and query optimization techniques. For
485+
example, add appropriate indexes to support aggregation stages
486+
before ``$lookup``.
480487

481488
- MongoDB only needs to run the ``$lookup`` subquery once before
482489
caching the query because there is no relationship between the
483-
source and foreign collections. The ``$lookup`` subquery is not
484-
based on any value in the source collection. This behavior
485-
improves performance for subsequent executions of this query.
486-
490+
source and foreign collections. The subquery is not based on
491+
any value in the source collection. This behavior improves
492+
performance for subsequent executions of the ``$lookup``
493+
operation.
487494

488495
* - :ref:`Correlated Subqueries <lookup-concise-correlated-subquery>`
489496

@@ -622,7 +629,7 @@ The operation corresponds to this pseudo-SQL statement:
622629
);
623630

624631
For more information, see
625-
:ref:`Equality Match Performance Considerations<equality-match-performance>`.
632+
:ref:`Equality Match Performance Considerations <equality-match-performance>`.
626633

627634
.. _unwind-example:
628635

0 commit comments

Comments
 (0)