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

$last/$first window functions repeat evaluation for every document in a static window

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      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.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: