-
Type: Task
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
Query Execution
Start mongod with "--setParameter internalQueryForceClassicEngine=false --setParameter featureFlagSBEGroupPushdown=true" and run the following query (if $min, $max accumulators aren't enabled yet, replace them with $sum)
db.LS.explain().aggregate([\{$group: {_id:"$a", o1:{$min:"$c"}, o2:\{$max:"$c"}}}]).queryPlanner.winningPlan.slotBasedPlan.stages
The output will look something like this:
[2] mkbson s14 [_id = s7, o1 = s12, o2 = s13] true false
[2] project [s12 = fillEmpty (s9, null), s13 = fillEmpty (s11, null)]
[2] group [s7] [s9 = min (let [l1.0 = s8] if (! exists (l1.0) || typeMatch (l1.0, 0x00000440), Nothing, l1.0)), s11 = max (let [l2.0 = s10] if (! exists (l2.0) || typeMatch (l2.0, 0x00000440), Nothing, l2.0))]
[2] project [s10 = getField (s4, "c")]
[2] project [s8 = getField (s4, "c")]
[2] project [s7 = fillEmpty (s6, null)]
[2] project [s6 = getField (s4, "a")]
[1] scan s4 s5 none none none none [] @"c494dfc1-7ed7-45e7-a46d-b253a1e532db" true false
Notice the duplicated getField on the same field "c". We should eliminate this inefficiency.
- backported by
-
SERVER-60893 Deduplicate field lookups for a same field path when $group is pushed down to SBE
- Closed