Data Store Management
A DynamoDB table uses orderId as its partition key and has no sort key. An application must retrieve a customer's orders by customerId, ordered by orderDate; eventual consistency is acceptable. What should the engineer configure?
Show the answer
Correct answerA. A global secondary index on customerId and orderDate
AWhy this is right: A global secondary index supports a different partition key and returns each customer's orders in sort-key order.
BWhy not this: A local secondary index retains the table's partition key and requires a table with a composite primary key.
CWhy not this: A filtered scan reads across the table and does not return results ordered by orderDate.
DWhy not this: A table query requires an orderId partition-key value; a filter cannot replace that key condition.
A global secondary index can use customerId as its partition key and orderDate as its sort key. A local secondary index must retain the table's partition key and cannot be added to this table.