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

queries that require nothing from document scans documents anyway on indexed queries

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      centos x64, mongo-10gen-server-1.8.2-mongodb_1 rpm
    • Linux

      > db.index.find(

      { subdomain: "sub.domain.com"}

      ,

      { __id:1}

      ).explain();
      {
      "cursor" : "BtreeCursor subdomain_1_folder_1_name_1",
      "nscanned" : 2002,
      "nscannedObjects" : 2002,
      "n" : 2002,
      "millis" : 6,
      "nYields" : 0,
      "nChunkSkips" : 0,
      "isMultiKey" : false,
      "indexOnly" : false,
      "indexBounds" : {
      "subdomain" : [
      [
      "sub.domain.com",
      "sub.domain.com"
      ]
      ],
      "folder" : [
      [

      { "$minElement" : 1 }

      ,

      { "$maxElement" : 1 }

      ]
      ],
      "name" : [
      [

      { "$minElement" : 1 }

      ,

      { "$maxElement" : 1 }

      ]
      ]
      }
      }

      > db.index.find(

      { subdomain: "sub.domain.org", folder: "" }

      ,

      {subdomain:1}

      ).explain();
      {
      "cursor" : "BtreeCursor subdomain_1_folder_1_name_1",
      "nscanned" : 1583,
      "nscannedObjects" : 1583,
      "n" : 1583,
      "millis" : 9,
      "nYields" : 2,
      "nChunkSkips" : 0,
      "isMultiKey" : false,
      "indexOnly" : false,
      "indexBounds" : {
      "subdomain" : [
      [
      "sub.domain.org",
      "sub.domain.org"
      ]
      ],
      "folder" : [
      [
      "",
      ""
      ]
      ],
      "name" : [
      [

      { "$minElement" : 1 }

      ,

      { "$maxElement" : 1 }

      ]
      ]
      }
      }

      mongo returns __id in both queries anyway, does that mean mongod needs to scan for objectid in objects and uses some other reference in indexes? i'm confused - it shouldn't touch objects at all for queries like this.

            Assignee:
            Unassigned Unassigned
            Reporter:
            ootada ttt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: