AZ-204 Develop for Azure storage Practice Question
You are designing an Azure Table Storage table to store temperature readings from IoT devices. Each reading includes a device ID (string), timestamp (datetime), temperature value, and location. You need to optimize the table design for this query: "Retrieve all temperature readings for a specific device ID within a given one-hour time range." The query must be efficient and minimize partition scans. Which PartitionKey and RowKey combination should you use?
⚠ Common exam trap
It's easy for candidates to choose a composite key (Option D) thinking it uniquely identifies rows, but they overlook that Azure Table Storage requires RowKey for range queries, and an empty RowKey prevents efficient filtering within a partition.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
PartitionKey = device ID, RowKey = timestamp (formatted as inverted ticks)
Using device ID as the PartitionKey ensures all readings for a specific device are in the same partition, allowing efficient point queries. Using timestamp formatted as inverted ticks (e.g., DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks) as the RowKey enables range queries within a one-hour window by leveraging the lexicographic ordering of RowKey values, minimizing partition scans.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
PartitionKey = device ID, RowKey = timestamp (formatted as inverted ticks)
Why this is correct
This design is optimal for querying a specific device's temperature history. By using 'device ID' as the PartitionKey, all temperature readings for a single device are co-located within the same physical partition, enabling highly efficient queries for that device. The 'timestamp (inverted ticks)' as RowKey ensures that entries within that partition are sorted in reverse chronological order, allowing for rapid range queries (e.g., all readings for a device within a specific time window) without incurring costly cross-partition scans.
- ✗
PartitionKey = timestamp (rolled up to day), RowKey = device ID
Why it's wrong here
Using 'timestamp (rolled up to day)' as the PartitionKey would scatter a single device's temperature data across numerous partitions, one for each day the device reports. Consequently, retrieving all temperature readings for a specific device over an extended period would necessitate multiple cross-partition queries, which are significantly less efficient and more expensive than queries confined to a single partition. The RowKey, 'device ID', would not be unique enough to efficiently isolate a device's data across these disparate partitions.
- ✗
PartitionKey = location, RowKey = device ID
Why it's wrong here
If 'location' is the PartitionKey, querying for all temperature data from a specific device becomes inefficient. A device's data would be grouped by its reporting location, meaning if a device moves or reports from multiple locations, its data would be fragmented across different partitions. Even if a device remains stationary, retrieving its complete history would require knowing its current and past locations to target the correct partitions, or performing a less efficient full scan across multiple location partitions if the device ID is not unique enough within a partition.
- ✗
PartitionKey = device ID + timestamp (composite), RowKey = empty
Why it's wrong here
A composite PartitionKey like 'device ID + timestamp' effectively creates a unique partition for every single temperature reading. This design eliminates the ability to group a device's data within a single partition and utilize a RowKey for ordering. Consequently, performing range queries (e.g., all readings for a specific device between two times) would require scanning a vast number of individual partitions, making such queries extremely inefficient and negating the performance benefits of Azure Table Storage's partitioning scheme.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.