Question 1
Topic: Design and develop database solutions
Skill tested: Selects a partition key that distributes high-throughput writes while supporting tenant-scoped access.
A telemetry service stores events for thousands of customer devices in Azure Cosmos DB for NoSQL. Queries usually retrieve one device's events over a time range, and each device can generate bursts exceeding the throughput available to a single logical partition. The current container is partitioned by customerId, so several large customers are approaching the per-partition storage and throughput limits. The application must retain customer-scoped query support, but a hot device must not force unrelated devices to share its write bottleneck. Which partition-key design is the best fit?
Partitioning by deviceId distributes a large customer's devices across logical partitions and prevents a single customer partition from becoming the shared write bottleneck. Customer-scoped queries can still filter on customerId, though they may fan out across partitions; the scenario prioritizes distributing device-level bursts. Raising throughput does not remove logical-partition limits, and timestamp partitioning can create poor query locality and hot values depending on timestamp granularity. A constant key places all data in one logical partition.