A developer is building a classroom management application that tracks student assignment submissions. The application stores submission records in an Amazon DynamoDB table. The base table has a partition key of `ClassId` and a sort key of `StudentId_AssignmentId`. The developer needs to retrieve all submissions for a specific class that were submitted after a certain date, sorted by submission date, while minimizing Read Capacity Unit (RCU) consumption.
Which TWO actions should the developer take to meet these requirements? (Select TWO.)
- Create a local secondary index (LSI) with ClassId as the partition key and SubmissionTimestamp as the sort key.Cevap
- Use the Query operation on the local secondary index (LSI) with a key condition expression for ClassId and SubmissionTimestamp.Cevap
- CUse the Scan operation on the base table with a filter expression on the SubmissionTimestamp attribute.
- DUse the Query operation on the base table and apply a filter expression on SubmissionTimestamp.
- EIncrease the provisioned read capacity units (RCUs) of the base table to prevent read throughput exceptions during the retrieval process.
Cevap
To retrieve submissions efficiently while minimizing RCU consumption, the developer should create a local secondary index (LSI) with ClassId as the partition key and SubmissionTimestamp as the sort key, and then use the Query operation on this index with a key condition expression specifying both ClassId and SubmissionTimestamp.
Creating a local secondary index (LSI) sharing the same partition key (ClassId) but using SubmissionTimestamp as the sort key allows the application to perform a Query operation. By querying the LSI with a key condition expression for the class and the timestamp range, DynamoDB only reads the matching items, minimizing the Read Capacity Units (RCUs) consumed and returning the results pre-sorted by the sort key.
Adım Adım Çözüm
Anahtar Kavram
Optimizing DynamoDB retrieval using Local Secondary Indexes (LSI) and Query operations instead of Scan or filter expressions on non-key attributes.
Tahmini Süre:1m 30s