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

Some queries using 2dsphere indexes in 2.6 rc1 scan a *lot* more documents than 2.4

    • ALL
    • Hide

      Import the ps.json file in 2.4 and in 2.6

      Run the query to see the difference in nScanned

      db.ps.find({'PROV_TIN_ADR.LATLONGDEGREE':{$near:{$geometry:

      {type : "Point" ,coordinates : [-78.898619,35.9940329] }

      , $maxDistance :482803}}}).limit(300).explain()

      Show
      Import the ps.json file in 2.4 and in 2.6 Run the query to see the difference in nScanned db.ps.find({'PROV_TIN_ADR.LATLONGDEGREE':{$near:{$geometry: {type : "Point" ,coordinates : [-78.898619,35.9940329] } , $maxDistance :482803}}}).limit(300).explain()

      Some geo-spatial queries in 2.6-rc1 scan a lot more documents than older versions. I have a 1.8 million doc collection. In 2.4, the query scans 440K rows, in 2.6, the query scans 1.4 million rows

      ===== 2.4 ====
      > db.ps.find({'PROV_TIN_ADR.LATLONGDEGREE':{$near:{$geometry:

      {type : "Point" ,coordinates : [-78.898619,35.9940329] }

      , $maxDistance :482803}}}).limit(300).explain()
      {
      "cursor" : "S2NearCursor",
      "isMultiKey" : true,
      "n" : 300,
      "nscannedObjects" : 300,
      "nscanned" : 441680,
      "nscannedObjectsAllPlans" : 300,
      "nscannedAllPlans" : 441680,
      "scanAndOrder" : false,
      "indexOnly" : false,
      "nYields" : 0,
      "nChunkSkips" : 0,
      "millis" : 696,
      "indexBounds" : {

      },
      "nscanned" : 441680,
      "matchTested" : NumberLong(32280),
      "geoMatchTested" : NumberLong(32280),
      "numShells" : NumberLong(8),
      "keyGeoSkip" : NumberLong(409400),
      "returnSkip" : NumberLong(3),
      "btreeDups" : NumberLong(0),
      "inAnnulusTested" : NumberLong(32280),
      "server" : "apxxx:27017"
      }

      =============== 2.6.rc1 ======================

      db.ps.find({'PROV_TIN_ADR.LATLONGDEGREE':{$near:{$geometry:

      {type : "Point" ,coordinates : [-78.898619,35.9940329] }

      , $maxDistance :482803}}}).limit(300).explain()
      {
      "cursor" : "S2NearCursor",
      "isMultiKey" : false,
      "n" : 300,
      "nscannedObjects" : 1405044,
      "nscanned" : 1405044,
      "nscannedObjectsAllPlans" : 1405044,
      "nscannedAllPlans" : 1405044,
      "scanAndOrder" : false,
      "indexOnly" : false,
      "nYields" : 10976,
      "nChunkSkips" : 0,
      "millis" : 8552,
      "indexBounds" : {

      },
      "server" : "apxxx:27017",
      "filterSet" : false
      }

        1. ps.json.gz
          22.90 MB
          Rajesh Khot

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            rajeXsh Rajesh Khot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: