Skip to content

Commit bd87c9f

Browse files
jmd-mongoandf-mongodb
authored andcommitted
DOCSP-13698 Index Intersection is rarely chosen by the query planner
1 parent 4dfeb71 commit bd87c9f

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

source/core/index-intersection.txt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,29 @@ Index Intersection
1010
:depth: 1
1111
:class: singlecol
1212

13-
.. versionadded:: 2.6
13+
.. important::
14+
15+
This page documents cases where the :doc:`query optimizer
16+
</core/query-plans>` **may** be able to use index intersection.
17+
18+
In practice, the :doc:`query optimizer </core/query-plans>` rarely
19+
selects plans that use index intersection.
20+
21+
Hash-based index intersection is disabled by default and sort-based
22+
index intersection is disfavored in plan selection. The optimizer
23+
behaves in this fashion in order to prevent bad plan selection.
24+
25+
Schema designs should not rely on index intersection. Instead,
26+
:doc:`compound indexes </core/index-compound>` should be used.
27+
28+
Future improvements to the query optimizer may allow the system to
29+
better identify cases where an index intersection plan would be
30+
beneficial.
1431

1532
MongoDB can use the intersection of multiple indexes to fulfill
16-
queries. [#previous-versions]_ In general, each index intersection
17-
involves two indexes; however, MongoDB can employ multiple/nested index
18-
intersections to resolve a query.
33+
queries. In general, each index intersection involves two indexes;
34+
however, MongoDB can employ multiple/nested index intersections to
35+
resolve a query.
1936

2037
To illustrate index intersection, consider a collection ``orders`` that
2138
has the following indexes:

0 commit comments

Comments
 (0)