An Orders table uses customer_id as the partition key, order_id as the sort key, and includes order_date as an attribute. A new access pattern requires querying by order_date and order_id. You must add a Lambda to support this access pattern with minimal operational overhead. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Add a global secondary index (GSI) to the table with order_date as the partition key and order_id as the sort key. Have the Lambda query the new GSI..
Why this is the answer
The correct solution is to add a global secondary index (GSI) with orderdate as the partition key and orderid as the sort key. GSIs allow querying on non-primary key attributes, providing an alternative access pattern. Since orderdate is not part of the original primary key (customerid, orderid), a GSI is necessary. Querying the GSI directly provides efficient access for the new pattern. A local secondary index (LSI) is incorrect because an LSI must share the same partition key as the base table (customerid), and the requirement is to query by orderdate. Performing a Scan is inefficient and expensive for large tables, leading to high operational overhead. DynamoDB Streams are for capturing item-level changes, not for querying historical data or creating new access patterns.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed