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

Covered index query scans docs

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 1.7.4
    • None
    • None
    • ALL

    Description

      It seems like it doesn't use the index (no indexOnly) to get data in the last find.

      > for (var i = 1; i <= 10000; i++) db.things.save(

      {value : i}

      );
      > db.things.find({value:{$gt: 500}}).explain()
      {
      "cursor" : "BasicCursor",
      "nscanned" : 10000,
      "nscannedObjects" : 10000,
      "n" : 9500,
      "millis" : 15,
      "nYields" : 0,
      "nChunkSkips" : 0,
      "isMultiKey" : false,
      "indexOnly" : false,
      "indexBounds" : {

      }
      }
      > db.things.ensureIndex(

      {value:1}

      )
      > db.things.find({value:{$gt: 500}},

      {value:1}

      ).explain()
      {
      "cursor" : "BtreeCursor value_1",
      "nscanned" : 9500,
      "nscannedObjects" : 9500,
      "n" : 9500,
      "millis" : 19,
      "nYields" : 0,
      "nChunkSkips" : 0,
      "isMultiKey" : false,
      "indexOnly" : false,
      "indexBounds" :

      { "value" : [ [ 500, 1.7976931348623157e+308 ] ] }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: