[DOCS-976] Improve description of nscanned and nscannedObjects Created: 11/Jan/13  Updated: 30/Oct/23  Resolved: 07/Aug/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Minor - P4
Reporter: Jeremy Mikola Assignee: Kay Kim (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 11 years, 5 weeks, 5 days ago

 Description   

See: http://docs.mongodb.org/manual/reference/explain/#explain-output-fields-core

Is nscanned always equal to the number of documents scanned on disk (i.e. nscannedObjects) plus any additional index entries scanned?

Can we clarify what "if the index is a covered index" means? william.zola@10gen.com said it likely means that the index is used for the entire query predicate (i.e. all fields in our criteria are also in the index).

If it helps, here's some discussion we had about it to provide context to my confusion:

Jeremy: yeah, covered index means nscannedObjects is 0, since we look at nothing on disk
Jeremy: saying "the value may be lower than nscanned" isn't as clear as saying "it should be 0" though, unless there's a case i'm missing where it may be covered but still not 0
William: I agree, docs could be better on query engine.
William: defining what they mean by a 'covered index' would be a start. Since I don't think they're using that term to mean 'covered query', which is a different beast altogether
Jeremy: perhaps they just mean a query that uses an index
Jeremy: i'll open a docs ticket for this
William: What they mean is a query where the index can satisfy the entire query predicate.
Jeremy: oh, so the entire matched set comes from the index
William: If the query condition includes fields not present in the index => nscannedObjects will be non-zero
William: (since the query engine will have to fetch the document & examine it to see if it matches the condition)
William: @Jeremy: right
Jeremy: and if the query condition includes fields only in the index, but it's not index-only for the projected fields, nscannedObjects will be equal to n
William: I think this also applies if you sort by a non-indexed field, but I wouldn't bet the rent on it.
William: I believe that to be correct as well.


Generated at Thu Feb 08 07:39:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.