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

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query Optimization
    • ALL

      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).

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: