An organization is developing a delivery driver tracking system that stores location logs in an Azure Cosmos DB container. The system processes thousands of status updates per minute from active drivers. Write operations are distributed evenly across all drivers, and the most common queries retrieve location history for a specific driver. The container must distribute storage and Request Units (RUs) uniformly without causing hot partitions. Which property should be configured as the partition key?
- driverIdAnswer
- Bcity
- Cstatus
- DlogId
Answer
driverId
Selecting driverId is correct because it has high cardinality and matches the query filter. This ensures that driver-specific queries are routed directly to a single partition (single-partition queries) while writes are evenly distributed across all active drivers.
Step-by-Step Solution
Key Concept
Selecting a partition key that matches query filters and has high cardinality to distribute throughput and storage.