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

Query planner could consider additional query plans for $or

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.6.1
    • None
    • Querying
    • None

    Description

      Prior to 2.6, the query planner would consider plans for $or beneath an $and according to a logical rewrite to disjunctive normal form. For example, suppose we have indices {a: 1, b: 1} and {a: 1, c: 1}. For the query

      db.coll.find({a: 3, $or: [{b: 4}, {c: 5}]});

      the query planner would instead plan this as

      db.coll.find({$or: [{a: 3, b: 4}, {a: 3, c: 5}]});

      The first clause uses the index {a: 1, b: 1} and the second uses {a: 1, c: 1}.

      In 2.6, the query planner does not consider this rewrite and therefore can miss some of the plans considered by 2.4.

      Attachments

        Issue Links

          Activity

            People

              hari.khalsa@10gen.com hari.khalsa@10gen.com
              david.storch@mongodb.com David Storch
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: