Skip to content

Commit 2172ae9

Browse files
mdb-ashleyAshley Brown
andauthored
DOCS-14409 Clarify multikey index usage (#773) (#915)
* Updating multikey sort fact; added glossary entry for blocking sort * Bug fixes * Bug fixes * Bug fixes * Incorporating internal review comments * Removing example * tweaks * Resolving internal review comments * Incorporating review comments Co-authored-by: Ashley Brown <[email protected]> Co-authored-by: Ashley Brown <[email protected]>
1 parent 1201010 commit 2172ae9

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
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:
65

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.

source/reference/glossary.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ Glossary
9090
maintenance operations on a sharded cluster. See
9191
:ref:`sharding-balancing`.
9292

93+
backup cursor
94+
A :term:`tailable cursor` that points to a list of backup files.
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.
104+
105+
bounded collection scan
106+
A plan used by the :doc:`query optimizer </core/query-plans>` that
107+
eliminates documents with specific field value ranges. For
108+
example, if a range of date field values is outside of a specified
109+
date range, the documents in that range are eliminated from the
110+
query plan. See :ref:`explain-output-collection-scan`.
111+
93112
BSON
94113
A serialization format used to store :term:`documents <document>` and make
95114
remote procedure calls in MongoDB. "BSON" is a portmanteau of the words
@@ -441,6 +460,12 @@ Glossary
441460
The international date format used by :binary:`~bin.mongo`
442461
to display dates. The format is: ``YYYY-MM-DD HH:MM.SS.millis``.
443462

463+
indexed sort
464+
A sort in which an index provides the sorted result. Sort operations that
465+
use an index often have better performance than a :term:`blocking sort`.
466+
See :ref:`Use Indexed to Sort Query Results <sorting-with-indexes>` for
467+
more information.
468+
444469
interrupt point
445470
A point in an operation's lifecycle when it can
446471
safely abort. MongoDB only terminates an operation

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Use Indexes to Sort Query Results
1414
:class: singlecol
1515

1616
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*
1818
use multiple indexes to support a sort operation *if* the sort uses the
1919
same indexes as the query predicate.
2020

@@ -24,7 +24,7 @@ A blocking sort indicates that MongoDB must consume and process all
2424
input documents to the sort before returning results. Blocking sorts do
2525
not block concurrent operations on the collection or database.
2626

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
2828
the blocking sort operation, MongoDB returns an error *unless* the query
2929
specifies :method:`cursor.allowDiskUse()` (*New in MongoDB 4.4*).
3030
:method:`~cursor.allowDiskUse()` allows MongoDB to use temporary files

0 commit comments

Comments
 (0)