[SERVER-14130] Query planner could consider additional query plans for $or Created: 02/Jun/14  Updated: 25/Jun/15  Resolved: 10/Sep/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.6.1
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: hari.khalsa@10gen.com
Resolution: Duplicate Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-13732 Predicates in top-level implicit AND ... Closed
is duplicated by SERVER-14740 Query rewrite of special $or leaf cas... Closed
Related
Participants:

 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.


Generated at Thu Feb 08 03:33:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.