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

$geoNear expands aggressively if the centroid is far from the dense data

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • 3.0.2
    • Geo
    • Query Integration

    Description

      I have a collection with 300,000 documents. In collection there is a 2dsphere index on 'geo' field.

      Here is a query I run:
      db.runCommand(

      { geoNear: "around_test", near: [59.6048899000000030, 36.2774393999999990], num: 500, spherical:true, query: null, }

      );

      Stats of this query are weird:
      stats:

      { "nscanned" : 103971, "objectsLoaded" : 80166, "avgDistance" : 0.1816846648955057, "maxDistance" : 0.1955302102158397, "time" : 1124 }

      In the query I limit results to 500 documents. But in stats I see that mongoDB reads 80166 (objectsLoaded) documents from disk and only then cuts it out.
      No need to read extra documents from disk if there is a limit on result length.

      Attachments

        Activity

          People

            backlog-query-integration Backlog - Query Integration
            andrey.hohutkin@gmail.com Andrey Hohutkin
            Votes:
            0 Vote for this issue
            Watchers:
            16 Start watching this issue

            Dates

              Created:
              Updated: