A developer is designing a DynamoDB table keyed by accountId and transactionId. The application also needs efficient, strongly consistent queries within an account ordered by postedAt; which design meets these requirements?
Show the answer
Correct answerC. Create a local secondary index with postedAt as its sort key
AWhy not this: Scanning and sorting is not an efficient keyed query and requires application-side ordering.
BWhy not this: A global secondary index supports the access pattern but cannot provide strongly consistent reads.
CWhy this is right: A local secondary index supports an alternative sort key within an account and strongly consistent queries.
DWhy not this: Filtering does not change the base table's transactionId ordering to postedAt ordering.
A local secondary index preserves the table's partition key, supplies an alternative sort key, and supports strongly consistent reads. A global secondary index provides an alternative key structure but supports only eventually consistent reads.