空分区键是一个问题(Cosmos DB)? [英] Is null partition key a problem (Cosmos DB)?

查看:136
本文介绍了空分区键是一个问题(Cosmos DB)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究使用Cosmos Db来存储产品和相关信息。使用产品ID作为分区键似乎是合乎逻辑的。那些没有产品ID的文件呢?例如。我可能会有一些列表,例如"产品位置"等。这是
只是应用程序用户可以选择的可能位置列表。或者我可能有类似用户首选项的内容。

I'm looking into using Cosmos Db for storing products and related information. Using product id as a partition key seems logical. What about documents that do not have product id? E.g. I might have some lists such as "Product location" which is just a list of possible locations application user can choose from. Or I might have something like user preferences.

我应该使用/ partitionKey和产品文档之类的东西,而不是将/ productid配置为分区键,我会在该字段中保存productid,用于设置我可以写"设置"等等。

Instead of configuring /productid as partition key should I use something like /partitionKey and for product documents I would save the productid in that field, for settings I could just write "setting" etc.

我打算只使用单个集合,因为文档数量(数千)和活跃用户数量非常低。

I'm planning on using only single collection because the amount of documents (few thousands) and number of active users is quite low.

推荐答案

分区键必须用于横向扩展方案,并且在自动存储管理中非常有用。  如果有保证您的数据不会超过10 GB。如果每个项目都是唯一的,你可以创建人工pk并存储它或更好 -
只是以这种方式将id提升为分区键 - 你将获得分区密钥,稍后当你的数据跨越它们时 - 自动存储管理可以为它增加空间。 

Partition key is must for scale out scenario and very helpful in automatic storage management.  In case where is there guarantee that your data will not exceed 10 GB. You can create artificial pk and store it or better yet if every item is unique - just promote id to be the partition key- in that way - you will get partition key and later on when your data grows across them - automatic storage management can take care of increasing space for it. 

根据我们的经验和你的 - 我们总是发现应用程序从用户开始很小等但是他们总是有可能比你原先计划的更远。因此,选择分区键以帮助后者增长至关重要。  

In our experience and yours - we always find applications starts small with users etc. But they always have potential to grow farther than you had planned. So it is essential that you choose a partition key to help latter growth.  





这篇关于空分区键是一个问题(Cosmos DB)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆