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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Query Optimization
    • QO 2021-10-04, QO 2021-10-18

    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

            backlog-query-optimization Backlog - Query Optimization
            christopher.harris@mongodb.com Chris Harris
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated: