Soru

Zorluk: KolayData Store Operations with Amazon DynamoDB

A developer is building a mobile shopping application that stores product details in an Amazon DynamoDB table. The application currently retrieves products belonging to a specific department by performing a Scan operation on the base table and filtering the results using a FilterExpression on the Department attribute. This is causing high latency and excessive Read Capacity Unit (RCU) consumption. Which two actions should the developer take to retrieve the products efficiently while minimizing RCU consumption? (Select TWO.)

  1. Create a Global Secondary Index (GSI) with Department as the partition key.Cevap
  2. Use the Query API operation on the GSI to retrieve the products.Cevap
  3. C
    Use a Scan operation with a FilterExpression to filter products by their department on the server side.
  4. D
    Use a ProjectionExpression in the Scan operation to only retrieve items matching the department.
  5. E
    Configure the DynamoDB client by hardcoding AWS access keys inside the application initialization code to bypass authorization overhead.

Cevap

Create a Global Secondary Index (GSI) with Department as the partition key, and use the Query API operation on the GSI to retrieve the products.
To optimize the read operations and minimize Read Capacity Unit (RCU) consumption, the developer should create a Global Secondary Index (GSI) using the Department attribute as the partition key, and then use the Query API operation instead of Scan. The Query operation only reads the items that share the target partition key, significantly reducing the RCU footprint compared to a full Scan.

Adım Adım Çözüm

1
Analyze the current data retrieval pattern.
The application performs a Scan on the base table and filters items using a FilterExpression.
To identify why the operation consumes excessive RCUs and causes latency.
2
Identify the performance bottleneck of Scan vs Query.
Scan operations read every item in the table before applying the FilterExpression, consuming RCUs proportional to the table size. Query operations only read items matching the specified partition key.
To choose the correct API operation for efficient retrieval.
3
Determine the necessary table configuration changes.
Create a Global Secondary Index (GSI) with Department as the partition key because the base table partition key cannot be used to query by department directly.
To enable the use of the Query operation on the Department attribute.

Anahtar Kavram

DynamoDB Query vs Scan optimization using Global Secondary Indexes (GSIs)
Bu soruyu puanla