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

Query planner could consider additional query plans for $or

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.1
    • Component/s: Querying
    • Labels:
      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 hari.khalsa@10gen.com
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: