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

Recursive estimation of nested index intersection/union plans.

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization

      Enterprise test> db.foo.aggregate([ { "$match": { "$and": [{ "a": 1 }, { "$or": [{ "b": "x" }, { "c": "y" }] }] } }]);
      MongoServerError[Location9768403]: FetchNode must have direct or indirect children that somehow filter data.
      

      The plan looks like this:

      winningPlan: {
            isCached: false,
            stage: 'FETCH',
            filter: {
              '$and': [
                { a: { '$eq': 1 } },
                {
                  '$or': [ { b: { '$eq': 'x' } }, { c: { '$eq': 'y' } } ]
                }
              ]
            },
            inputStage: {
              stage: 'AND_HASH',
              inputStages: [
                {
                  stage: 'IXSCAN',
                  keyPattern: { a: 1 },
                  indexName: 'a_1',
                  isMultiKey: false,
                  multiKeyPaths: { a: [] },
                  isUnique: false,
                  isSparse: false,
                  isPartial: false,
                  indexVersion: 2,
                  direction: 'forward',
                  indexBounds: { a: [ '[1, 1]' ] }
                },
                {
                  stage: 'OR',
                  inputStages: [
                    {
                      stage: 'IXSCAN',
                      keyPattern: { b: 1 },
                      indexName: 'b_1',
                      isMultiKey: false,
                      multiKeyPaths: { b: [] },
                      isUnique: false,
                      isSparse: false,
                      isPartial: false,
                      indexVersion: 2,
                      direction: 'forward',
                      indexBounds: { b: [ '["x", "x"]' ] }
                    },
                    {
                      stage: 'IXSCAN',
                      keyPattern: { c: 1 },
                      indexName: 'c_1',
                      isMultiKey: false,
                      multiKeyPaths: { c: [] },
                      isUnique: false,
                      isSparse: false,
                      isPartial: false,
                      indexVersion: 2,
                      direction: 'forward',
                      indexBounds: { c: [ '["y", "y"]' ] }
                    }
                  ]
                }
              ]
            }
          },
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            philip.stoev@mongodb.com Philip Stoev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: