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.)
- Perform a Query operation specifying the VehicleId in the KeyConditionExpressionCevap
- Use a KeyConditionExpression to restrict the LogTimestamp values using a comparison operatorCevap
- CPerform a Scan operation and apply a FilterExpression to isolate the specific VehicleId and LogTimestamp range
- DPerform a GetItem operation by providing the VehicleId and a list of target timestamps
- EInitialize 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
Anahtar Kavram
Querying DynamoDB tables with composite primary keys using partition and sort keys