Query planner could consider additional query plans for $or

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.1
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

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

                Created:
                Updated:
                Resolved: