Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
None
-
Query Execution
-
QE 2023-12-11, QE 2023-12-25, QE 2024-01-08
-
3
Description
In SBE plan cache key, we encode the number of elements in $in in it:
This is done because of explode for sort SBE plan will have the number of branches equal to the number of elements in $in.
However, this will lead to worse plan caching even for queries, where is no plan caching.
It is a fact that we have users that use $in's with arbitrary amount of elements from 1 to thousands.
Also, if a query have multiple $ins, it may lead to exponential growth.
One suggestion is instead of generating a unique plan for every $in size when exploding for sort, we can generate plans for all powers of 2 (or 4) and use the smallest plan that can fit all $in values.
Attachments
Issue Links
- is related to
-
SERVER-82548 MongoDB 7.0.2 SBE selects a different index when doing $in with a large array
-
- Closed
-
-
SERVER-84728 Allow MatchExpression $or -> $in rewrite to preserve parameters
-
- Investigating
-
- related to
-
SERVER-83777 Cap $in length in plan cache key with internalQueryMaxScansToExplode + 1
-
- Closed
-