Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-74893

Change default enumeration strategy for planning $or queries

    • Query Optimization
    • Fully Compatible
    • v7.0
    • QO 2023-05-15, QO 2023-05-29, QO 2023-06-12, QO 2023-06-26, QO 2023-07-10, QO 2023-07-24, QO 2023-08-07, QO 2023-08-21, QO 2023-09-04

      SERVER-50291 introduced the internalQueryEnumerationPreferLockstepOrEnumeration parameter that modifies the order in which the plans are generated for 'contained $or' queries. This turns out to often be helpful in practice as:

      1. It is often the case that the query shapes are constructed in such a way that using the same index for all of the branches yields the optimal query plan.
      2. There is a modest limit on how many such plans we will generate (and therefore consider) during query planning.

      This new(er) enumeration strategy is currently still off (false) by default. 

      As there is not much evidence to support the idea that the current strategy is superior to the alternative, and there have been successful uses of the new enumeration strategy to improve query execution, we should update the default to be the new strategy beginning in the next major release. That is to say that internalQueryEnumerationPreferLockstepOrEnumeration should be true by default going forward.

            ruoxin.xu@mongodb.com Ruoxin Xu
            christopher.harris@mongodb.com Chris Harris
            0 Vote for this issue
            9 Start watching this issue