-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
Fully Compatible
-
QO 2022-03-07
During pipeline optimization, we currently rewrite a $or with equality conditions on the same path into a $in. That is:
{$or: [{a: 1}, {a: 2}]}
becomes
{a: {$in: [1, 2]}}.
There is also support to rewrite part of a $or as follows:
{$or: [{a: 1}, {a: 2}, {b: 3}]}
becomes
{$or: [{a: {$in: [1, 2]}}, {b: 3}].
The first part of the optimization (replacing an entire $or with an $in) is supported by the new optimizer in the logical rewrites phase. The second part is not yet supported by the new optimizer. Eventually, when we don't run pipeline optimization before we hit the new optimizer, we'll need to support this behavior in the new optimizer.
- related to
-
SERVER-34012 Planner's logic for taking union of index bounds intervals is slow for large $or queries
- Closed