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

Count plans sometimes don't need a FETCH

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.9
    • Component/s: Aggregation Framework
    • Labels:
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL
    • Sprint:
      Query 2017-06-19
    • Case:

      Description

      Not sure why this is happening, but given index on username:1 match by username and group on username correctly uses covered index, but grouping on constant does not:

      aggregate { aggregate: "t1", pipeline: [ { $match: { username: /^a/ } }, { $group: { _id: "$username", count: { $sum: 1.0 } } } ], cursor: {} } planSummary: IXSCAN { username: 1.0 } keysExamined:2 docsExamined:0 cursorExhausted:1 numYields:0 nreturned:1
      aggregate { aggregate: "t1", pipeline: [ { $match: { username: /^a/ } }, { $group: { _id: 1.0, count: { $sum: 1.0 } } } ], cursor: {} } planSummary: IXSCAN { username: 1.0 } keysExamined:2 docsExamined:1 cursorExhausted:1 numYields:0 nreturned:1
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              anne.lim Anne Lim
              Reporter:
              asya Asya Kamsky
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: