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

Metric "document.scanned" is not the same as nscannedObjects (from explain)

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.0-rc2
    • Component/s: Querying
    • Query
    • Fully Compatible
    • ALL

      The scanned value comes from cursor.scanned() which is not the same as the docs loaded/scanned (nscannedOjbects in explain) but is instead the indexes (entries) scanned or number of docs returned.

      This can be shown easily using a covered query:

      > var firstSS = db.serverStatus()
      > db.g.find({b:2},{ b:1, _id:0}).explain()
      {
      	"cursor" : "BtreeCursor b_1",
      	"isMultiKey" : false,
      	"n" : 2,
      	"nscannedObjects" : 0,
      	"nscanned" : 2,
      	"nscannedObjectsAllPlans" : 0,
      	"nscannedAllPlans" : 2,
      ...}
      > db.serverStatus().metrics.document.scanned - firstSS.metrics.document.scanned
      2
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: