File tree Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change 1
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.
2
+ 4.4, when you sort on an array indexed with a
3
+ :ref: `multikey index <index-type-multikey >`, the query plan includes
4
+ a :term: `blocking sort ` stage, unless:
6
5
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.
6
+ - The index :ref: `boundaries <multikey-index-bounds-intersecting >` for all sort
7
+ fields are ``[MinKey, MaxKey] ``, *and *
8
+
9
+ - No boundaries for any multikey-indexed field have the same path prefix as the sort
10
+ pattern.
Original file line number Diff line number Diff line change @@ -93,6 +93,14 @@ Glossary
93
93
backup cursor
94
94
A :term:`tailable cursor` that points to a list of backup files.
95
95
Backup cursors are for internal use only.
96
+
97
+ blocking sort
98
+ A sort that must be performed in memory before output is returned.
99
+ Blocking sorts may impact performance for large data sets. Use an
100
+ :term:`indexed sort` to avoid a blocking sort.
101
+
102
+ See :ref:`sort-index-use` for more information on blocking sort
103
+ operations.
96
104
97
105
BSON
98
106
A serialization format used to store :term:`documents <document>` and make
@@ -445,6 +453,12 @@ Glossary
445
453
The international date format used by :binary:`~bin.mongosh`
446
454
to display dates. The format is: ``YYYY-MM-DD HH:MM.SS.millis``.
447
455
456
+ indexed sort
457
+ A sort in which an index provides the sorted result. Sort operations that
458
+ use an index often have better performance than a :term:`blocking sort`.
459
+ See :ref:`Use Indexed to Sort Query Results <sorting-with-indexes>` for
460
+ more information.
461
+
448
462
interrupt point
449
463
A point in an operation's lifecycle when it can
450
464
safely abort. MongoDB only terminates an operation
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Use Indexes to Sort Query Results
14
14
:class: singlecol
15
15
16
16
Since indexes contain ordered records, MongoDB can obtain the results of
17
- a sort from an index with which includes the sort fields. MongoDB *may*
17
+ a sort from an index that includes the sort fields. MongoDB *may*
18
18
use multiple indexes to support a sort operation *if* the sort uses the
19
19
same indexes as the query predicate.
20
20
@@ -24,7 +24,7 @@ A blocking sort indicates that MongoDB must consume and process all
24
24
input documents to the sort before returning results. Blocking sorts do
25
25
not block concurrent operations on the collection or database.
26
26
27
- If MongoDB requires using more than 100 megabytes of system memory for
27
+ If MongoDB needs more than 100 megabytes of system memory for
28
28
the blocking sort operation, MongoDB returns an error *unless* the query
29
29
specifies :method:`cursor.allowDiskUse()` (*New in MongoDB 4.4*).
30
30
:method:`~cursor.allowDiskUse()` allows MongoDB to use temporary files
You can’t perform that action at this time.
0 commit comments