[SERVER-15204] Skip validation for stored geometry if a 2dsphere index exists Created: 10/Sep/14  Updated: 08/Sep/21  Resolved: 06/Aug/15

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.7.6
Fix Version/s: 3.1.7

Type: Improvement Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Kevin Albertson
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-19097 New geo index version for geo perform... Closed
Related
related to SERVER-57938 Skip polygon validation for stored Ge... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

When parsing a polygon, we always validate the geometries, like checking whether it's self-intersected among other sanity checks. (S2 already has optimizations for this rather than using the naive O(n^2) algorithm). The dependency graph given by CPU profiling shows this validation takes 80% of the running time for polygons with thousands vertices. If there is already an index on the geo field, this validation is guaranteed by the index, so we can skip it for stored geometries.



 Comments   
Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'kevinAlbs', u'name': u'Kevin Albertson', u'email': u'kevin.albertson@10gen.com'}

Message: SERVER-15204 Skip unnecessary validation on indexed polygons and lines
Branch: master
https://github.com/mongodb/mongo/commit/53ead9a708208978228de918fafa7835655e0632

Comment by Siyuan Zhou [ 25/Sep/14 ]

aplimovil - Sorry for the confusion. This issue only affects users who store polygons. I mentioned this ticket in SERVER-13568 because that use case is $geoIntersect query, which is different from you original issue about $near/$nearSphere in SERVER-13568. So I tried to redirect him to the right place to track his issue.

Comment by Abraham Lopez [ 25/Sep/14 ]

I'm confused then. How's this ticket related to the SERVER-13568 ticket then? I say this because you reference this SERVER-15204 ticket in there.

Comment by Siyuan Zhou [ 24/Sep/14 ]

aplimovil, please allow me to clarify this issue. I believe this is a separate issue from SERVER-13568, because in SERVER-13568 the parsing of points is very light when "running a find() on a GeoJSON Point field". This parsing issue only happens on complex geometries, like polygons.

Siyuan,
Thanks

Comment by Abraham Lopez [ 24/Sep/14 ]

This issue causes $near/$nearSphere to be very slow when using 2DSphere indexes, as filed in SERVER-13568.

Please update the aforementioned ticket when this is tackled, so we can confirm the fix with the original test scenario.

Thanks.

Generated at Thu Feb 08 03:37:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.