Skip to content

Commit 529e50b

Browse files
authored
DOCSP-21633 v4.2 backport(#1414)
1 parent 0214d58 commit 529e50b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

source/core/aggregation-pipeline-optimization.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,18 @@ Indexes
387387
-------
388388

389389
Starting in MongoDB 4.2, in some cases, an aggregation pipeline can use
390-
a ``DISTINCT_SCAN`` index plan, which typically has higher performance
391-
than ``IXSCAN``.
390+
a ``DISTINCT_SCAN`` index plan that returns one document per index key
391+
value.
392+
393+
.. note::
394+
``DISTINCT_SCAN`` executes faster than ``IXSCAN`` if multiple
395+
documents per index value exist. However, index scan parameters
396+
might affect the time comparison of ``DISTINCT_SCAN`` and
397+
``IXSCAN``.
398+
399+
Indexes can :ref:`cover <read-operations-covered-query>` queries in an
400+
aggregation pipeline. A covered query uses an index to return all of the
401+
documents and has high performance.
392402

393403
Example
394404
-------

0 commit comments

Comments
 (0)