Medium1 markMultiple Choice
Domain 2.4: Non-Relational Data StorageDomain 2Cosmos DBPartitioningPerformance

AZ-305 · Question 27 · Domain 2.4: Non-Relational Data Storage

You are designing an Azure Cosmos DB (NoSQL API) database for an IoT fleet management system.

The system receives telemetry from 100,000 vehicles. Each vehicle sends a JSON document every minute. The most common query run by the application is: SELECT * FROM c WHERE c.VehicleId = 'V-12345' AND c.Timestamp > '2023-01-01'.

You need to select a partition key that ensures even distribution of storage and throughput, and minimizes cross-partition queries.

Which property should you choose as the partition key?

Answer options:

A.

/Timestamp

B.

/VehicleId

C.

/FleetRegion

D.

/id

How to approach this question

A good partition key needs high cardinality (many unique values) for write distribution, and should be present in the WHERE clause of common queries for read efficiency.

Full Answer

B./VehicleId✓ Correct
/VehicleId
In Cosmos DB, choosing the right partition key is critical. `/VehicleId` is the best choice. It has high cardinality (100,000 vehicles), meaning writes will be evenly distributed across physical partitions, avoiding hot spots. Furthermore, the most common query filters by `VehicleId`. By partitioning on `VehicleId`, Cosmos DB can route the query to a single physical partition, making the read highly efficient. Partitioning by `/Timestamp` would cause all current writes to hit a single partition (hot spot).

Common mistakes

Choosing `/id`. While it distributes writes perfectly, it ruins read performance because querying by `VehicleId` would require scanning every single partition (cross-partition query).

Practice the full Azure Solutions Architect Expert AZ-305 Practice Exam 5

55 questions · hints · full answers · grading

More questions from this exam