Skip to content

Commit dc7fced

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

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
@@ -537,22 +537,29 @@ different ``$lookup`` operations.
537537

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

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

544-
- .. _uncorrelated-subqueries-performance:
545+
* - :ref:`Uncorrelated Subqueries <lookup-uncorrelated-subquery>`
545546

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

550557
- MongoDB only needs to run the ``$lookup`` subquery once before
551558
caching the query because there is no relationship between the
552-
source and foreign collections. The ``$lookup`` subquery is not
553-
based on any value in the source collection. This behavior
554-
improves performance for subsequent executions of this query.
555-
559+
source and foreign collections. The subquery is not based on
560+
any value in the source collection. This behavior improves
561+
performance for subsequent executions of the ``$lookup``
562+
operation.
556563

557564
* - :ref:`Correlated Subqueries <lookup-concise-correlated-subquery>`
558565

@@ -691,7 +698,7 @@ The operation corresponds to this pseudo-SQL statement:
691698
);
692699

693700
For more information, see
694-
:ref:`Equality Match Performance Considerations<equality-match-performance>`.
701+
:ref:`Equality Match Performance Considerations <equality-match-performance>`.
695702

696703
.. _unwind-example:
697704

0 commit comments

Comments
 (0)