Courseiva
Workload-Specific Database DesignhardMultiple ChoiceObjective-mapped

DBS-C01 Workload-Specific Database Design Practice Question

A company uses Amazon DynamoDB to store IoT sensor data. Each sensor sends data every second, and the application needs to query the latest reading from each sensor. The sensor ID is the partition key, and the timestamp is the sort key. The table has millions of sensors. Which query pattern is most efficient to get the latest reading for a specific sensor?

⚠ Common exam trap

The DBS-C01 exam often tests the misconception that GetItem can be used with a partial key or that Scan with a filter is acceptable for single-item retrieval, but the trap here is that candidates overlook the efficiency of using Query with sort key ordering and limit to fetch the most recent item without scanning or guessing timestamps.

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

Use Query with KeyConditionExpression on sensor ID, ScanIndexForward=false, Limit=1

Query with ScanIndexForward=false and Limit=1 retrieves only the most recent item for a given partition key (sensor ID) by reading items in descending sort key (timestamp) order and stopping after one item. This is the most efficient pattern as it uses the primary key index directly, avoids scanning, and minimizes read capacity consumption.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use BatchGetItem with the sensor ID and multiple timestamps

    Why it's wrong here

    BatchGetItem requires known sort keys and cannot find the latest without prior knowledge.

  • Use Scan with FilterExpression on sensor ID

    Why it's wrong here

    Scan reads all items and is inefficient.

  • Use GetItem with the sensor ID and the current timestamp

    Why it's wrong here

    The exact timestamp is unknown; this would require an additional query to find the latest.

  • Use Query with KeyConditionExpression on sensor ID, ScanIndexForward=false, Limit=1

    Why this is correct

    This retrieves the most recent item for that sensor efficiently.

About these practice questions

One of 1,663 original DBS-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DBS-C01 practice question is part of Courseiva's free Amazon Web Services 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 DBS-C01 exam.