Soru

Zorluk: KolayData Store Operations with Amazon DynamoDB

A developer is building a backend service for an IoT-based fleet tracking application. Telemetry data is stored in an Amazon DynamoDB table designed with VehicleId as the partition key and LogTimestamp as the sort key. The developer needs to retrieve all telemetry events recorded for a specific vehicle over a specific 24-hour period. Which two actions should the developer take to retrieve this data with the lowest latency and minimal Read Capacity Unit (RCU) consumption? (Select TWO.)

  1. Perform a Query operation specifying the VehicleId in the KeyConditionExpressionCevap
  2. Use a KeyConditionExpression to restrict the LogTimestamp values using a comparison operatorCevap
  3. C
    Perform a Scan operation and apply a FilterExpression to isolate the specific VehicleId and LogTimestamp range
  4. D
    Perform a GetItem operation by providing the VehicleId and a list of target timestamps
  5. E
    Initialize the AWS SDK client inside the application code using hardcoded access keys to speed up API authorization

Cevap

To retrieve the telemetry events efficiently, the developer must perform a Query operation specifying the vehicle identifier in the key condition expression, and restrict the timestamp values within the target 24-hour range in the key condition expression.
Performing a Query operation specifying the partition key in the key condition expression, and using the sort key in the key condition expression to filter by the timestamp range, allows DynamoDB to efficiently locate and return only the requested items from a single partition without reading unrelated data.

Adım Adım Çözüm

1
Identify the primary key structure of the DynamoDB table.
The table uses a composite primary key consisting of a partition key (VehicleId) and a sort key (LogTimestamp).
Understanding the key structure is necessary to choose the correct read API operation.
2
Determine the most efficient API operation for retrieving a range of items sharing a partition key.
A Query operation is selected because it targets a single partition key and allows sorting/filtering on the sort key.
Using Query instead of Scan avoids reading the entire table, minimizing latency and RCU usage.
3
Configure the key condition expression for the Query operation.
The expression specifies the exact VehicleId and applies a range condition on the LogTimestamp.
This retrieves only the items matching both criteria directly from the partition.

Anahtar Kavram

Querying DynamoDB tables with composite primary keys using partition and sort keys
Bu soruyu puanla