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

Strange behaviour of spatial queries

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.6
    • Component/s: Index Maintenance
    • None
    • ALL

      I have two MongoDB databases (named real and synthetic) where each one has one collection (named geoPoints).

      The two collections have the same number of documents with 4 fields (one of the fields are geoObjectJSON named location and its type is Point with longitude and latitude). They do not contain the same documents and they have 2d sphere indexes.

      The execution of a spatial query on the collection of the real database is performed in 9 seconds (returning approximately 2M documents). Executing a query (larger in terms of spatial extent) on the collection of the synthetic database returns fewer documents (about 400k) and is performed in 5144s. The difference of the queries' execution time is huge. Is it reasonable for a spatial query which return fewer documents than a spatial query that returns more results, to require more time for its execution?

      The mentioned execution time of the queries are after running them 3 times.

      I attach the queryPlanner information for the two queries

        1. diagnostic-data.zip
          40.73 MB
        2. explain-real.txt
          10 kB
        3. explain-syntetic.txt
          8 kB
        4. mongod.log
          659 kB

            Assignee:
            eric.sedor@mongodb.com Eric Sedor
            Reporter:
            nickkoutr Nikolaos Koutroumanis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: