简体   繁体   English

在 Cosmos DB 集合中选择“分区键”

[英]Choosing "Partition Key" in Cosmos DB collection

I have a collection which will store at around 1 millions records monthly in cosmos db collection, which comes to 4-5 GB of data quarterly.我有一个集合,它每月在 cosmos db 集合中存储大约 100 万条记录,每季度有 4-5 GB 的数据。 I want to create a partition key based on "EventType", but in this case also, each "EventType" reach up 10 GB limit within in a year.我想根据“EventType”创建一个分区键,但在这种情况下,每个“EventType”在一年内达到 10 GB 的限制。

So the next option for us to create a partition key based on "PayerNumber" field.因此,我们的下一个选项是根据“PayerNumber”字段创建分区键。 But we may have 10,000 unique payer numbers.但是我们可能有 10,000 个唯一的付款人编号。

Is it a good idea to choose this field("PayerNumber") to create a partition key?选择此字段(“PayerNumber”)来创建分区键是个好主意吗? How many logical partitions are supported by Cosmos DB? Cosmos DB 支持多少个逻辑分区? Is there any limit to it?有什么限制吗?

Following is the sample json:以下是示例 json:

{
"PayerName": "XYZ",
"PayerNumber": "XYZ00000667",
"EventType": "CARD_BLOCK",
"EventTypeDescription": "CARD_BLOCK",
"ModifiedByUUID": "4f371d98-0e31-442b-9ff9-9dcf4a629640",
"ModifiedByUserName": "Postman",
"SubscriptionIsPayerAccountBased": false,
"Data": [
    {
        "AccountName": "XYZ",
        "AccountNumber": "XYZ00000667",
        "DriverName": "DSDSDS",
        "ExpiryDate": "2019-03-31",
        "PAN": "*******912068",
        "Status": "Active",
        "VRN": "FDFDFD"
    }
]

} }

There is no limit to logical partitions in Cosmos DB. Cosmos DB 中的逻辑分区没有限制。 You should read choosing the right partition key article.您应该阅读选择正确的分区键文章。 You might want to create an artificial partition key, based on how your data will be spread.您可能希望根据数据的分布方式创建一个人工分区键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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