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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: 3.0.2
    • Fix Version/s: Backlog
    • Component/s: Geo

      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

        1. around_test.7z
          3.69 MB
          Andrey Hohutkin

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-execution Backlog - Query Execution
              Reporter:
              andrey.hohutkin@gmail.com Andrey Hohutkin
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

                Dates

                Created:
                Updated: