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

DISTINCT_SCAN can be used with compound index when filter is on non-multikey field

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • Querying
    • None
    • Query Optimization
    • ALL

    Description

      If you have an index on a:1, b:1 and distinct command or agg equivalent

      db.foo.distinct("b", {a:1})
      

      we use DISTINCT_SCAN unless b is multikey - and it's not clear why - it doesn't need IXSCAN nor FETCH (which is what it shows using).

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated: