-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Currently timeseries bounded sort optimization is implemented after we already created an execution plan: https://github.com/mongodb/mongo/blob/6f450a3cea6287612329f44e90536d72fe7c16c5/src/mongo/db/pipeline/pipeline_d.cpp#L1225
Because of this, to decide if we can do this optimization, we have to introspect PlanExecutorImpl and extract runtime information, such as sort order provided by the query, in a complex way, instead of using query planning interface, provided by QuerySolution.
This also makes the code fragile.
For example, implementing exclusion projection pushdown (SERVER-61284) breaks the code, because it doesn't support PROJECTION_* nodes as root of query execution tree.