Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-976

Improve description of nscanned and nscannedObjects

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Cannot Reproduce
    • Icon: Minor - P4 Minor - P4
    • Server_Docs_20231030
    • None
    • manual
    • None

    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.

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 5 weeks, 5 days ago