-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Partial indexes in MongoDB only include documents that match a specific filter expression. As a result, they are incompatible with SBE $lookup operations because SBE requires the entire collection to be indexed.
Proposed Solution for SBE:
The Classic engine avoids this issue because it re-plans the lookup for each local field value. The inability of SBE to correctly handle this scenario with partial indexes represents a regression for MongoDB users.
To resolve this and allow SBE to use sparse indexes, we should adopt a strategy similar to how SBE handles index collation incompatibility (SERVER-81555):
- If the local field value satisfies the filter expression: Use the partial index.
- If the local field value does not satisfy the expression: Perform a collection scan.
- is related to
-
SERVER-81555 $lookup on foreign field uses index in classic but not in SBE when collations do not match
-
- Closed
-
- related to
-
SERVER-116154 Do not push $lookup to SBE if there is an eligible sparse index
-
- Backlog
-
-
SERVER-116517 Do not push $lookup to SBE if there is an eligible partial index
-
- Backlog
-