Question

Difficulty: MediumConfigure Partition Keys and Partitioning Strategies in Azure Cosmos DB

A document collaboration platform stores real-time edit logs in an Azure Cosmos DB Core (SQL) API container. Each log document contains a `logId` (GUID), `documentId` (String), `userId` (String), `timestamp` (DateTime, formatted as `YYYY-MM-DDTHH:mm:ssZ`), and `editType` (String).

The workload exhibits the following characteristics:
- Write profile: High-frequency write operations occur as more than 1000010{}000 users concurrently edit documents during peak business hours.
- Read profile: The platform frequently retrieves edit history for a specific document on a specific day to show revisions.
- Transactional profile: The application executes transactional batches to group and commit multiple edits for the same document on the same calendar day.

You must design a partitioning strategy that avoids hot partitions, supports the transactional consistency requirements, and optimizes query performance.

Which two actions should you perform? (Select two.)

  1. Create a synthetic partition key by concatenating the `documentId` and the date portion of the `timestamp` in the application code.Answer
  2. Configure the container partition key path to point to the new custom property that holds the concatenated value.Answer
  3. C
    Configure the container partition key path to point to `/timestamp` to distribute writes evenly across time-based partitions.
  4. D
    Set `/logId` as the partition key path and execute transactional batches to update multiple documents across different logical partitions.

Answer

Create a synthetic partition key by concatenating the `documentId` and the date portion of the `timestamp` in the application code, and configure the container partition key path to point to the new custom property that holds this concatenated value.
To satisfy the requirement of executing transactional batches, all documents in a batch must share the same partition key value. By concatenating the document identifier and the daily date portion of the timestamp, you create a synthetic partition key that is unique per document per day. This allows all edits for a single document on a given day to be committed together in a single transaction. To apply this, the application must write this concatenated value to a custom property, and the container must be configured to use this custom property as its partition key path.

Step-by-Step Solution

1
Analyze transactional requirements.
Identified that transactional batches in Azure Cosmos DB require all operations to share the same partition key value.
Azure Cosmos DB does not support multi-partition transactions, so the partition key must encompass the transactional scope (document edits on the same day).
2
Evaluate write workloads and check for hot partitions.
Determined that using a simple key like timestamp or date alone would cause hot partition issues under high write volumes.
A high concentration of writes on the current date or timestamp will route all requests to a single physical partition, resulting in rate limiting.
3
Formulate a synthetic partition key.
Created a concatenated value combining `documentId` and the date portion of the `timestamp` (e.g., `DOC123_2026-07-16`).
This synthetic key distributes writes across different documents (high cardinality) while keeping edits for the same document on the same day in the same partition.

Key Concept

Synthetic partition keys allow combining multiple properties to distribute write workloads while keeping related data in the same logical partition to support transactions.
Rate this question