[SERVER-8912] Metric "document.scanned" is not the same as nscannedObjects (from explain) Created: 08/Mar/13  Updated: 06/Dec/22  Resolved: 22/Mar/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.4.0-rc2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 0
Labels: metrics, stats
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-12774 "nscanned" not logged anymore for que... Closed
Related
related to SERVER-10448 Revamp explain() formatting Closed
is related to SERVER-17862 Unify stats reporting for log/profile... Closed
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

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



 Comments   
Comment by James Wahlin [ 22/Mar/16 ]

This issue was fixed under SERVER-12774 for MongoDB version 2.6.0 and later.

Comment by J Rassi [ 15/Jun/15 ]

This should be simple to implement once SERVER-17862 is resolved. Linking as related.

Generated at Thu Feb 08 03:18:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.