Skip to content

Commit 4bf2bc8

Browse files
Merge pull request #223354 from seesharprun/cosmos-rework-partition-key-limit
Cosmos DB | Clarify partition key value size limit
2 parents c6f9008 + 5c8a6c1 commit 4bf2bc8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

articles/cosmos-db/concepts-limits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ An Azure Cosmos DB item can represent either a document in a collection, a row i
156156
| Resource | Limit |
157157
| --- | --- |
158158
| Maximum size of an item | 2 MB (UTF-8 length of JSON representation) <sup>1</sup> |
159-
| Maximum length of partition key value | 2048 bytes |
159+
| Maximum length of partition key value | 2048 bytes (101 bytes if large partition-key is not enabled) |
160160
| Maximum length of ID value | 1023 bytes |
161161
| Allowed characters for ID value | Service-side all Unicode characters except for '/' and '\\' are allowed. <br/>**WARNING: But for best interoperability we STRONGLY RECOMMEND to only use alpha-numerical ASCII characters in the ID value only**. <br/>There are several known limitations in some versions of the Cosmos DB SDK, as well as connectors (ADF, Spark, Kafka etc.) and http-drivers/libraries etc. that can prevent successful processing when the ID value contains non-alphanumerical ASCII characters. So, to increase interoperability, please encode the ID value - [for example via Base64 + custom encoding of special charatcers allowed in Base64](https://github.com/Azure/azure-cosmos-dotnet-v3/blob/78fc16c35c521b4f9a7aeef11db4df79c2545dee/Microsoft.Azure.Cosmos.Encryption/src/EncryptionProcessor.cs#L475-L489). - if you have to support non-alphanumerical ASCII characters in your service/application. |
162162
| Maximum number of properties per item | No practical limit |

articles/cosmos-db/partitioning-overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ For **all** containers, your partition key should:
100100

101101
* Spread request unit (RU) consumption and data storage evenly across all logical partitions. This ensures even RU consumption and storage distribution across your physical partitions.
102102

103+
* Have values that are no larger than 2048 bytes typically, or 101 bytes if large partition keys are not enabled. For more information, see [large partition keys](large-partition-keys.md)
104+
103105
If you need [multi-item ACID transactions](database-transactions-optimistic-concurrency.md#multi-item-transactions) in Azure Cosmos DB, you will need to use [stored procedures or triggers](how-to-write-stored-procedures-triggers-udfs.md#stored-procedures). All JavaScript-based stored procedures and triggers are scoped to a single logical partition.
104106

105107
> [!NOTE]

0 commit comments

Comments
 (0)