[SERVER-72038] Better projection analysis for $replace(With|Root) Created: 12/Dec/22  Updated: 31/Oct/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Charlie Swanson Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-72037 Allow $replace(With|Root) to particip... Open
Assigned Teams:
Query Optimization
Participants:

 Description   

I'm thinking of a query like so:

db.foo.aggregate([{$replaceWith: "$x"}, {$match: {y: 1}}, {$project: {y: 1}}])

SERVER-72037 describes the work to push the $match before the $replaceWith. But even if that is complete, we would seem to stop our projection/dependency analysis at the $replaceWith stage there and miss that the query only needs "x.y", not all of "x". If "x" had many sub-fields, this could be a dramatic savings.


Generated at Thu Feb 08 06:20:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.