Friday 15 February 2013

query optimization - MongoDB - Geospatial intersection performance -


We are developing a small device that will allow a person to attract a polygon on Google Maps, and this Will return the zip code that overlaps the generated overlay (over) I thought it would be a great time to dip into a node SQL database, because I work with large data sets, I have a lot of good stuff about performance Have heard.

So I have all the ZCTA (zip code array area) size as per the US Census Data Data Data and it loads into a MongoDB as follows. Sample document:

  {"zipcode": 12345, "polygon": {type: "polygon", coordinates: [[[lng1, lat1], [lng2, lat2], ... I also have an index set on the polygon column:  
  db.ZipCodes.ensureIndex (in the end) [lngN, latN]]]}   

, I translate the number from Google Polygon to another GeoJSON polygon, and use $ geoIntersects to ask the data as follows:

  db . & Lt; collection & gt; ({"polygon": {$ geoIntersects: {$ geometry: {type: "polygon", coordinate: [[[lng1, lat1], [l] Ng2, lat2], ..., [lngN, latN]]]}}}})   

Overlay polygon is small, but when polygon span says, then some states (US) , Query takes forever (& gt; 20 minutes!). How can I get this more appropriate response time? I have indexed the ZIP code polygon, and since then I am inquiring about it , I would agree that it would be as optimized as possible. Am I indexing incorrectly?

Ywad advance!

After tearing my hair, try to know the best way to get better performance in MongoDB I decided to try my existing standard DB, SQL Server, I think my low expectations for the geospatial functionality of SQL Server were unfounded. In the query & lt; 12 seconds without any index, and not stretched on a high scale like mongodibi for large drawn polygons. After adding an index, most questions are in 1 second range.

I think that everything I know will be stuck with it. I really had high hopes for MongoDB, but there is a lot of geopolitical performance (or severely less-documented about how to improve it).

No comments:

Post a Comment