From 9a319f246fd786facbbdd31028126d43413562e3 Mon Sep 17 00:00:00 2001 From: Joseph Dougherty Date: Fri, 22 Jan 2021 16:34:22 -0500 Subject: [PATCH] DOCSP-13698 Index Intersection is rarely chosen by the query planner --- source/core/index-intersection.txt | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/source/core/index-intersection.txt b/source/core/index-intersection.txt index bd2374da44a..b0eaf7c8c16 100644 --- a/source/core/index-intersection.txt +++ b/source/core/index-intersection.txt @@ -10,10 +10,29 @@ Index Intersection :depth: 1 :class: singlecol +.. important:: + + This page documents cases where the :doc:`query optimizer + ` **may** be able to use index intersection. + + In practice, the :doc:`query optimizer ` rarely + selects plans that use index intersection. + + Hash-based index intersection is disabled by default and sort-based + index intersection is disfavored in plan selection. The optimizer + behaves in this fashion in order to prevent bad plan selection. + + Schema designs should not rely on index intersection. Instead, + :doc:`compound indexes ` should be used. + + Future improvements to the query optimizer may allow the system to + better identify cases where an index intersection plan would be + beneficial. + MongoDB can use the intersection of multiple indexes to fulfill -queries. In general, each index intersection -involves two indexes; however, MongoDB can employ multiple/nested index -intersections to resolve a query. +queries. In general, each index intersection involves two indexes; +however, MongoDB can employ multiple/nested index intersections to +resolve a query. To illustrate index intersection, consider a collection ``orders`` that has the following indexes: