Skip to content

Commit c2db348

Browse files
jeff-allen-mongokay-kim
authored andcommitted
DOCS-11338 - Add multikey index sort limitation to tutorial and manual pages
1 parent 55f4405 commit c2db348

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

source/core/index-multikey.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ an array; you do not need to explicitly specify the multikey type.
4141

4242
.. versionchanged:: 3.4
4343

44-
*For the WiredTiger and In-Memory storage engines only*,
44+
*For the WiredTiger and In-Memory storage engines only*,
4545

4646
Starting in MongoDB 3.4, for multikey indexes created using MongoDB
4747
3.4 or later, MongoDB keeps track of which indexed field or fields
@@ -104,7 +104,7 @@ array. That is:
104104
A compound multikey index ``{ a: 1, b: 1 }`` is permissible since for
105105
each document, only one field indexed by the compound multikey index
106106
is an array; i.e. no document contains array values for both ``a``
107-
and ``b`` fields.
107+
and ``b`` fields.
108108

109109
However, after creating the compound multikey index, if you attempt
110110
to insert a document where both ``a`` and ``b`` fields are arrays,
@@ -131,6 +131,11 @@ For an example, see :ref:`multikey-embedded-documents`.
131131

132132
- :ref:`index-unique-index`
133133

134+
Sorting
135+
~~~~~~~
136+
137+
.. include:: /includes/fact-multikey-index-sort-limitation.rst
138+
134139
Shard Keys
135140
~~~~~~~~~~
136141

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
As a result of changes to sorting behavior on array fields in MongoDB
2+
3.6, when sorting on an array indexed with a
3+
:doc:`multikey index </core/index-multikey/>` the query plan includes
4+
a blocking SORT stage. The new sorting behavior may negatively impact
5+
performance.
6+
7+
In a blocking SORT, all input must be consumed by the sort step before
8+
it can produce output. In a non-blocking, or *indexed* sort, the
9+
sort step scans the index to produce results in the requested order.

source/release-notes/3.6-compatibility.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,9 @@ account when choosing the array element which will act as the
130130
As a result of this change, applications that currently sort by an
131131
array field may experience a different sort order.
132132

133-
.. note ::
133+
.. note::
134134

135-
As of version 3.6, the query engine cannot use a
136-
:doc:`multikey index </core/index-multikey/>` to provide a
137-
non-blocking sort by an array field. If you try to sort in this
138-
manner, the query plan will include a blocking SORT stage, which
139-
may negatively impact performance.
135+
.. include:: /includes/fact-multikey-index-sort-limitation.rst
140136

141137
.. _3.6-find-method-sort:
142138

source/tutorial/sort-results-with-indexes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ memory. Sort operations that use an index often have better performance
2020
than those that do not use an index. In addition, sort operations that
2121
do *not* use an index will abort when they use 32 megabytes of memory.
2222

23+
.. note::
24+
25+
.. include:: /includes/fact-multikey-index-sort-limitation.rst
26+
2327
.. _sort-results-single-field:
2428

2529
Sort with a Single Field Index

0 commit comments

Comments
 (0)