Azure Cosmos DB-了解分区键 [英] Azure Cosmos DB - Understanding Partition Key

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

问题描述

我正在设置我们的第一个Azure Cosmos数据库-我将导入第一个集合中的数据,这些数据来自我们一个SQL Server数据库中一个表中的数据.在设置集合时,我在理解分区键的含义和要求时遇到了麻烦,在设置此初始集合时,我必须特别指出这些含义和要求.

I'm setting up our first Azure Cosmos DB - I will be importing into the first collection, the data from a table in one of our SQL Server databases. In setting up the collection, I'm having trouble understanding the meaning and the requirements around the partition key, which I specifically have to name while setting up this initial collection.

我在这里阅读了文档:( https ://docs.microsoft.com/zh-cn/azure/cosmos-db/documentdb-partition-data ),但仍不确定如何继续使用此分区键的命名约定.

I've read the documentation here: (https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-partition-data) and still am unsure how to proceed with the naming convention of this partition key.

有人可以帮助我理解命名此分区键的方式吗?请参阅下面的屏幕快照,以获取我要填写的字段.

Can someone help me understand how I should be thinking in naming this partition key? See the screenshot below for the field I'm trying to fill in.

为帮助起见,我要导入的表由7列组成,包括唯一主键,非结构化文本列,URL列以及该记录的URL的其他几个辅助标识符.不知道这些信息是否与我应如何命名我的分区密钥有关.

In case it helps, the table I'm importing consists of 7 columns, including a unique primary key, a column of unstructured text, a column of URL's and several other secondary identifiers for that record's URL. Not sure if any of that information has any bearing on how I should name my Partition Key.

根据@Porschiey的请求,我已经添加了我要从中导入的表中的几条记录的屏幕快照.

I've added a screenshot of several records from the table from which I'm importing, per request from @Porschiey.

推荐答案

老实说,

Honestly the video here* was a MAJOR help to understanding partitioning in CosmosDb.

但是,简而言之: PartitionKey是一个将存在于每个对象上的属性,最适合将相似的对象组合在一起.

But, in a nutshell: The PartitionKey is a property that will exist on every single object that is best used to group similar objects together.

很好的例子包括位置(如城市),客户ID,团队等.自然,这完全取决于您的解决方案.因此,也许如果您要发布对象的外观,我们可能会推荐一个好的分区键.

Good examples include Location (like City), Customer Id, Team, and more. Naturally, it wildly depends on your solution; so perhaps if you were to post what your object looks like we could recommend a good partition key.

应该注意的是,对于10GB以下的集合,不需要PartitionKey. (感谢David Makogon)

Should be noted that PartitionKey isn't required for collections under 10GB. (thanks David Makogon)

* 视频曾经住在此MS文档页面,标题为在Azure Cosmos DB中进行分区和水平缩放",但此后已删除.上面提供了直接链接.

* The video used to live on this MS docs page entitled, "Partitioning and horizontal scaling in Azure Cosmos DB", but has since been removed. A direct link has been provided, above.

这篇关于Azure Cosmos DB-了解分区键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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