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

Use knowledge about partial index filter expression to determine whether $exists predicate can be covered

    XMLWordPrintable

Details

    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • 3.2.10
    • None
    • Querying

    Description

      Given documents of the form

      {
          _id: ObjectId("..."),
          a: "2016-08-07",
          ...
          b: 2222,
          c: 3333
          ...
      },
      {
          _id: ObjectId("..."),
          a: "2016-08-07"
          c: 4444,
          ...
      },
      {
          _id: ObjectId("..."),
          a: "2016-08-07",
          ...
          b: 4444,
          c: 5555
          ...
      },
      

      And a partial index of the form

      db.foo.createIndex({a: -1, b: 1}, partialFilterExpression: {b: {$exists: true}})
      

      The query planner can use this index to fully cover a query of the following form:

      db.foo.find({a: { $lte: '2016-08-11' }, b: {$exists: true}}, {_id: 0, a: 1})
      

      Attachments

        Issue Links

          Activity

            People

              backlog-query-optimization Backlog - Query Optimization
              peter.garafano@mongodb.com Peter Garafano (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated: