[DOCS-3187] Difference between nscanned and nscannedObjects is unclear Created: 16/Apr/14 Updated: 16/Mar/15 Resolved: 01/Jul/14 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual |
| Affects Version/s: | mongodb-2.6 |
| Fix Version/s: | v1.3.7 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Joe Drumgoole (Inactive) | Assignee: | Tim Slavin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Participants: | |
| Days since reply: | 9 years, 20 weeks, 5 days ago |
| Description |
|
On this page http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-fields-core The explanation of the difference between nscanned and nscannedObjects in the explain plan is unclear. Need to define the specific differences between the two outputs and give a clear example of a query that will produce different outputs. e.g. explain.nscannedObjects explain.nscanned |
| Comments |
| Comment by Githook User [ 26/Sep/14 ] |
|
Author: {u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}Message: |
| Comment by Githook User [ 26/Sep/14 ] |
|
Author: {u'username': u'TimSlavinMongoDB', u'name': u'Tim Slavin (MongoDB)', u'email': u'tim.slavin@10gen.com'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Joe Drumgoole (Inactive) [ 16/Apr/14 ] |
|
This blog has a better explanation: http://emptysqua.re/blog/optimizing-mongodb-compound-indexes/ "For indexed queries, nscanned is the number of index keys in the range that Mongo scanned, and nscannedObjects is the number of documents it looked at to get to the final result. nscannedObjects includes at least all the documents returned, even if Mongo could tell just by looking at the index that the document was definitely a match. Thus, you can see that nscanned >= nscannedObjects >= n always. For simple queries you want the three numbers to be equal. It means you've created the ideal index and Mongo is using it." |