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

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

问题描述

我正在设置我们的第一个 Azure Cosmos DB - 我将把我们的一个 SQL Server 数据库中表中的数据导入到第一个集合中.在设置集合时,我无法理解分区键的含义和要求,我在设置此初始集合时特别需要命名.

我在这里阅读了文档:(

如果有帮助,我正在导入的表由 7 列组成,包括一个唯一的主键、一列非结构化文本、一列 URL 和该记录 URL 的其他几个辅助标识符.不确定这些信息是否与我应该如何命名我的分区键有关.

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

解决方案

老实说 此处的视频* 对理解 CosmosDb 中的分区非常有帮助.

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

好的示例包括位置(如城市)、客户 ID、团队等.当然,这很大程度上取决于您的解决方案.因此,也许如果您要发布对象的外观,我们可以推荐一个好的分区键.

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

<小时>

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

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.

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.

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.

EDIT: 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.

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.

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.

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


* 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天全站免登陆