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

Minimize index scanning when retrieving distinct values grouped by more than one field

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:
      None

      Description

      MongoDB 4.2 introduced the ability to avoid full index scans for aggregation pipelines that include a specific type of $group stage - those that logically request distinct information which can be obtained by scanning a single document.  This was initially implemented via SERVER-9507.

      As confirmed by this comment from a related enhancement in SERVER-40090, this optimization currently only applies when the aggregation is grouping on a single field.  We should consider expanding this optimization, or a similar one, to reduce index scanning when the _id specified for the $group is on multiple fields.    

        Attachments

          Activity

            People

            Assignee:
            backlog-query-optimization Backlog - Query Optimization
            Reporter:
            christopher.harris Christopher Harris
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: