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

Optimized $group/DISTINCT_SCAN does not respect hint

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 4.1.10
    • Fix Version/s: 4.2.0-rc3, 4.3.1
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.2
    • Sprint:
      Query 2019-06-17

      Description

      > db.c.createIndex({a:1})
      > db.c.insert({a:1})
      WriteResult({ "nInserted" : 1 })
      > db.c.aggregate({$group: {_id: "$a"}})
      { "_id" : 1 }
      > db.c.explain().aggregate({$group: {_id: "$a"}})
      // Distinct scan!
      > db.c.explain().aggregate([{$group: {_id: "$a"}}], {hint: {$natural: 1}})
      // Still distinct scan
      

      This is probably because of the special codepath here which doesn't consider the hint.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              misha.ivkov Mikhail Ivkov (Inactive)
              Reporter:
              ian.boros Ian Boros
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: