简体   繁体   中英

How to use Geospatial data in CosmosDB with Partitioning

What is the recommended strategy for using CosmosDB with Geospatial data? Cosmos DB requires a partition key and a single partition cannot exceed 10GB. So if I have more than 10GB of data:

  1. I cannot choose a Geospatial index as a partition key
  2. I manually create a partition key that will have a geographical component (ie by city)
  3. A single spatial query cannot straddle two partitions. So if I have land areas in EastLondon and WestLondon , I cannot search database to find out if they intersect.

What's the practical way to use it?

It would be ideal if the partition key could just be a geospatial attribute. However, based on my reading, the answer is that you should limit your number of partitions, to the minimum necessary to store your data. If the partitions intersect, you would have to store the intersecting bits redundantly. If you limit the number of 20GB ( increased since you wrote your question perhaps) partitions, then the cost of cross-partition queries should be minimized.

A potential approach to living with this is to store only an ID with your geospatial data, then you can store and retrieve details associated with that ID elsewhere. This could be accomplished via a join for instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM