[SERVER-64219] $last/$first window functions repeat evaluation for every document in a static window Created: 04/Mar/22 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Nicholas Zolnierz | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| Description |
|
The executors for $last/$first do not cache results, even if the window is static ([unbounded, unbounded]). This means that we will evaluate the same expression against the same document for every document in the window. Without partitioning it's probably not an interesting case, but I could imagine a query such as "give me the last measurement per device" would be impacted by this. |