Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
None
-
Query Optimization
Description
If we have a query of the form db.coll.count({a: null}) with a non-multikey index {a: 1}, we generate a plan that is an OR of two COUNT_SCANs, where one encodes the bound [null, null], and the other encodes the bound [undefined, undefined].
We could extend this optimization to cover cases where we have something like db.coll.count({$or: [
{a: null}, {a: ""}]}) with an OR on three COUNT_SCANS: one for null, one for undefined, and one for "". This can be applied similarly to other covered null $in intervals.