Skip to content

Commit 541cf8a

Browse files
authored
DOCSP 21633 adding DISTINCT_SCAN explanation (#1405)
* DOCSP-21633 adding distinct_scan documentation * DOCSP-21633 fixing bullets * DOCSP-21633 fixing format
1 parent 4f1a795 commit 541cf8a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source/core/aggregation-pipeline-optimization.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,14 @@ The following list shows some pipeline stages that can use indexes:
509509
must be the first stage in an aggregation pipeline.
510510

511511
Starting in MongoDB 4.2, in some cases, an aggregation pipeline can use
512-
a ``DISTINCT_SCAN`` index plan, which typically has higher performance
513-
than ``IXSCAN``.
512+
a ``DISTINCT_SCAN`` index plan that returns one document per index key
513+
value.
514+
515+
.. note::
516+
``DISTINCT_SCAN`` executes faster than ``IXSCAN`` if multiple
517+
documents per index value exist. However, index scan parameters
518+
might affect the time comparison of ``DISTINCT_SCAN`` and
519+
``IXSCAN``.
514520

515521
Indexes can :ref:`cover <read-operations-covered-query>` queries in an
516522
aggregation pipeline. A covered query uses an index to return all of the

0 commit comments

Comments
 (0)