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

QueryOptimizer not choosing the right key when querying.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
    • Environment:
      Linux vizvid-mongo-1 3.2.0-31-virtual #50-Ubuntu SMP Fri Sep 7 16:36:36 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux 8GB ram
    • Operating System:
      Linux

      Description

      mongos> db.current_views.find({ ts:

      { $gte: 1352300700, $lt: 1352301000 }

      , site: "506f0fea7cbdc70464aea9e9" } ).explain()
      {
      "clusteredType" : "ParallelSort",
      "shards" : {
      "vizvid-mongo-1:27019" : [
      {
      "cursor" : "BtreeCursor site_1",
      "isMultiKey" : false,
      "n" : 3413,
      "nscannedObjects" : 4470768,
      "nscanned" : 4470768,
      "nscannedObjectsAllPlans" : 4470768,
      "nscannedAllPlans" : 4470768,
      "scanAndOrder" : false,
      "indexOnly" : false,
      "nYields" : 29754,
      "nChunkSkips" : 0,
      "millis" : 16086,
      "indexBounds" :

      { "site" : [ [ "506f0fea7cbdc70464aea9e9", "506f0fea7cbdc70464aea9e9" ] ] }

      ,
      "server" : "vizvid-mongo-1:27019"
      }
      ]
      },
      "cursor" : "BtreeCursor site_1",
      "n" : 3413,
      "nChunkSkips" : 0,
      "nYields" : 29754,
      "nscanned" : 4470768,
      "nscannedAllPlans" : 4470768,
      "nscannedObjects" : 4470768,
      "nscannedObjectsAllPlans" : 4470768,
      "millisShardTotal" : 16086,
      "millisShardAvg" : 16086,
      "millis" : 16086,
      "indexBounds" :

      { "site" : [ [ "506f0fea7cbdc70464aea9e9", "506f0fea7cbdc70464aea9e9" ] ] }

      ,
      "server" : "vizvid-mongo-1:27019"
      }
      ]
      },
      "cursor" : "BtreeCursor site_1",
      "n" : 3413,
      "nChunkSkips" : 0,
      "nYields" : 29754,
      "nscanned" : 4470768,
      "nscannedAllPlans" : 4470768,
      "nscannedObjects" : 4470768,
      "nscannedObjectsAllPlans" : 4470768,
      "millisShardTotal" : 16086,
      "millisShardAvg" : 16086,
      "numQueries" : 1,
      "numShards" : 1,
      "indexBounds" :

      { "site" : [ [ "506f0fea7cbdc70464aea9e9", "506f0fea7cbdc70464aea9e9" ] ] }

      ,
      "millis" : 16087
      }
      ###########################
      .... Now with the hint ....
      ###########################
      mongos> db.current_views.find({ ts:

      { $gte: 1352300700, $lt: 1352301000 }

      , site: "506f0fea7cbdc70464aea9e9" } ).hint(

      {ts:1, site:1}

      ).explain()
      {
      "clusteredType" : "ParallelSort",
      "shards" : {
      "vizvid-mongo-1:27019" : [
      {
      "cursor" : "BtreeCursor ts_1_site_1",
      "isMultiKey" : false,
      "n" : 3413,
      "nscannedObjects" : 3413,
      "nscanned" : 3472,
      "nscannedObjectsAllPlans" : 3413,
      "nscannedAllPlans" : 3472,
      "scanAndOrder" : false,
      "indexOnly" : false,
      "nYields" : 1,
      "nChunkSkips" : 0,
      "millis" : 27,
      "indexBounds" :

      { "ts" : [ [ 1352300700, 1352301000 ] ], "site" : [ [ "506f0fea7cbdc70464aea9e9", "506f0fea7cbdc70464aea9e9" ] ] }

      ,
      "server" : "vizvid-mongo-1:27019"
      }
      ]
      },
      "cursor" : "BtreeCursor ts_1_site_1",
      "n" : 3413,
      "nChunkSkips" : 0,
      "nYields" : 1,
      "nscanned" : 3472,
      "nscannedAllPlans" : 3472,
      "nscannedObjects" : 3413,
      "nscannedObjectsAllPlans" : 3413,
      "millisShardTotal" : 27,
      "millisShardAvg" : 27,
      "numQueries" : 1,
      "numShards" : 1,
      "indexBounds" :

      { "ts" : [ [ 1352300700, 1352301000 ] ], "site" : [ [ "506f0fea7cbdc70464aea9e9", "506f0fea7cbdc70464aea9e9" ] ] }

      ,
      "millis" : 29
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aaron Aaron Staple
              Reporter:
              eka Esteban Feldman
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: