geoNear generates search intervals intended to contain between 300 and 600 documents. The minimum distance of each search interval is the same as the maximum distance of the previous one.
In the current implementation, it will create an approximate covering of the search interval using index cells. This covering may contain index cells that were already scanned in the previous search interval, resulting in the same index cells and documents being checked more than once. For dense data, these search intervals will be very thin, resulting in an inaccurate covering that will likely contain many cells that were already in coverings of previous search intervals.
Possible solution:
Maintain a union of all of the cells that have been contained in previous coverings. When generating the covering for a new search interval, only cover the region that does not intersect with the union.
This solution will improve performance for queries that require many search intervals, but will slightly slow performance for queries that only require one search interval because it will fetch all the documents in the covering regardless of whether they are in the search interval.
- is depended on by
-
SERVER-18056 2d nearSphere performance regression
-
- Closed
-
- is duplicated by
-
SERVER-13568 Near search using find() with 2DSphere index is very slow vs. using a 2D index
-
- Closed
-