[SERVER-70998] Extend OR of COUNT_SCANs for null queries to include other types Created: 01/Nov/22 Updated: 05/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Alya Berciu | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| 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. |