Soru

Zorluk: KolayData Store Operations with Amazon DynamoDB

A developer is building a product catalog application where items are stored in an Amazon DynamoDB table. The developer wants to retrieve specific product items based on their category while keeping the read latency and consumption of Read Capacity Units (RCUs) as low as possible. Which of the following strategies should the developer implement to achieve this goal? (Select TWO.)

  1. Use the Query API operation instead of the Scan API operation to retrieve items.Cevap
  2. Create a Global Secondary Index (GSI) with the product category as the partition key if it is not the partition key of the base table.Cevap
  3. C
    Use the Scan API operation and apply a FilterExpression to return only the products matching the specific category.
  4. D
    Hardcode AWS access keys directly in the application's SDK client configuration to ensure immediate authentication and bypass credential retrieval latency.
  5. E
    Increase the table's provisioned read capacity units whenever a ProvisionedThroughputExceededException occurs, without analyzing partition key distribution.

Cevap

To optimize DynamoDB operations, the developer should use the Query API operation instead of the Scan API operation, and create a Global Secondary Index (GSI) with the product category as the partition key if it is not the partition key of the base table.
Using the Query operation directly targets the relevant partition and retrieves only the matching items, minimizing RCU usage. Additionally, defining a Global Secondary Index (GSI) with the category as the partition key enables the Query operation even when the category is not the base table's partition key.

Adım Adım Çözüm

1
Analyze the retrieval requirements and compare API options.
The Query operation uses the partition key to find items directly, whereas the Scan operation reads the entire table, making Query much more efficient for retrieving specific categories.
Selecting Query over Scan reduces latency and RCU consumption.
2
Evaluate the table structure for the query attribute.
If the product category is not the partition key of the base table, a Scan would normally be required. However, creating a Global Secondary Index (GSI) with the category as the partition key enables Query operations on that attribute.
GSIs allow querying on non-key attributes of the base table, avoiding costly full table scans.

Anahtar Kavram

Optimizing DynamoDB reads using Query operations and Secondary Indexes instead of Scans.
Tahmini Süre:1m 0s
Bu soruyu puanla