[SERVER-37304] Extend $sort+$group+$first pipeline optimization to $last Created: 24/Sep/18  Updated: 29/Oct/23  Resolved: 08/Dec/22

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Justin Seyster Assignee: Alya Berciu
Resolution: Fixed Votes: 1
Labels: optimization, query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-55576 Optimize queries on time-series colle... Closed
is related to SERVER-9507 Optimize $sort+$group+$first pipeline... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query Optimization 2021-06-14, Query Optimization 2021-06-28, Query Optimization 2021-07-12, Query Optimization 2021-07-26, QO 2021-09-06, Query Optimization 2021-08-09, QO 2021-09-20, QO 2021-10-04, QO 2021-10-18, QO 2021-11-01, QO 2021-11-15, QO 2021-11-29, QO 2021-12-13, QO 2021-12-27, QO 2022-01-10, QO 2022-01-24, QO 2022-02-07, QO 2022-02-21, QO 2022-03-07, QO 2022-03-21, QO 2021-08-23, QO 2022-04-04, QO 2022-04-18, QO 2022-05-02, QO 2022-05-16, QO 2022-05-30, QO 2022-06-13, QO 2022-06-27, QO 2022-07-11
Participants:

 Description   

The optimization described in SERVER-9507 can be applied to $group expressions that exclusively use $last accumulators by running the DISTINCT_SCAN in the reverse direction.



 Comments   
Comment by Githook User [ 08/Dec/22 ]

Author:

{'name': 'Alya Berciu', 'email': 'alya.berciu@mongodb.com', 'username': 'alyacb'}

Message: SERVER-37304 Extend $sort+$group+$first optimization to $last
Branch: master
https://github.com/mongodb/mongo/commit/5d6305f18e82a6824c2c32bfcccdea919332bb5b

Comment by Anton Korshunov [ 11/Jul/22 ]

Marking for re-triage as it's been sitting in QO sprints long enough without any progress.

Comment by Eric Daniels (Inactive) [ 25/Sep/18 ]

Correct

Comment by David Storch [ 25/Sep/18 ]

eric.daniels, can you clarify whether this optimization is required by Stitch? It's the optimization from SERVER-9507, except extended to work for $last in addition to $first. My understanding is that the pipelines which you need optimized will use $first, but not $last. Is that correct?

Generated at Thu Feb 08 04:45:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.