Skip to content

Commit acf13d8

Browse files
(DOCSP-35695): Update optimization info for lookup (#5857) (#5866)
* (DOCSP-35695): Update optimization info for lookup * consistency * wording * edits * review edit * tech review edits
1 parent 1b6c603 commit acf13d8

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

source/reference/operator/aggregation/lookup.txt

+18-11
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,29 @@ different ``$lookup`` operations.
534534

535535
- ``$lookup`` operations that perform equality matches with a
536536
single join typically perform better when the source collection
537-
contains an index on the ``foreignField``.
537+
contains an index on the ``localField``.
538538

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

541-
- .. _uncorrelated-subqueries-performance:
542+
* - :ref:`Uncorrelated Subqueries <lookup-uncorrelated-subquery>`
542543

543-
- ``$lookup`` operations that contain uncorrelated subqueries
544-
typically perform better when the inner pipeline can reference
545-
an index on the ``foreignField``.
544+
- .. _uncorrelated-subqueries-performance:
545+
546+
- An index on the foreign collection cannot support uncorrelated
547+
subqueries.
548+
549+
- To improve performance for uncorrelated subqueries, use generic
550+
indexing strategies and query optimization techniques. For
551+
example, add appropriate indexes to support aggregation stages
552+
before ``$lookup``.
546553

547554
- MongoDB only needs to run the ``$lookup`` subquery once before
548555
caching the query because there is no relationship between the
549-
source and foreign collections. The ``$lookup`` subquery is not
550-
based on any value in the source collection. This behavior
551-
improves performance for subsequent executions of this query.
552-
556+
source and foreign collections. The subquery is not based on
557+
any value in the source collection. This behavior improves
558+
performance for subsequent executions of the ``$lookup``
559+
operation.
553560

554561
* - :ref:`Correlated Subqueries <lookup-concise-correlated-subquery>`
555562

@@ -688,7 +695,7 @@ The operation corresponds to this pseudo-SQL statement:
688695
);
689696

690697
For more information, see
691-
:ref:`Equality Match Performance Considerations<equality-match-performance>`.
698+
:ref:`Equality Match Performance Considerations <equality-match-performance>`.
692699

693700
.. _unwind-example:
694701

0 commit comments

Comments
 (0)