Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-47466

Optimize $push in $group to limit array size if followed by $slice of same field

    • Query Optimization

      If I have a pipeline

      {$group:{_id:"any", a:{$push:"$x"}}}, {$project:{a:{$slice:["$a",0,5]}}}
      

      We can pull in knowledge that only first 5 elements are needed from "a" in $group and stop pushing more elements after we have that many.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: