AWS Certified Database – Specialty — Question 344
A social media company is using Amazon DynamoDB to store user profile data and user activity data. Developers are reading and writing the data, causing the size of the tables to grow significantly. Developers have started to face performance bottlenecks with the tables.
Which solution should a database specialist recommend to read items the FASTEST without consuming all the provisioned throughput for the tables?
Answer options
- A. Use the Scan API operation in parallel with many workers to read all the items. Use the Query API operation to read multiple items that have a specific partition key and sort key. Use the GetItem API operation to read a single item.
- B. Use the Scan API operation with a filter expression that allows multiple items to be read. Use the Query API operation to read multiple items that have a specific partition key and sort key. Use the GetItem API operation to read a single item.
- C. Use the Scan API operation with a filter expression that allows multiple items to be read. Use the Query API operation to read a single item that has a specific primary key. Use the BatchGetItem API operation to read multiple items.
- D. Use the Scan API operation in parallel with many workers to read all the items. Use the Query API operation to read a single item that has a specific primary key Use the BatchGetItem API operation to read multiple items.
Correct answer: B
Explanation
Using the GetItem API is the most efficient way to retrieve a single item by its primary key, while the Query API is optimized for fetching multiple items that share the same partition key. Using a parallel scan as suggested in other options would consume excessive provisioned throughput and worsen performance bottlenecks. Therefore, combining GetItem, Query, and Scan with filter expressions provides the fastest reads while conserving throughput.