Soru

Zorluk: Çok zorData Store Operations with Amazon DynamoDB

A developer is designing a real-time fleet logistics tracking system. The system stores shipment event logs in an Amazon DynamoDB table. The table has `CarrierID` (String) as the partition key and `EventID` (String) as the sort key. The application must support three operations:

1. Retrieve all event logs for a specific carrier within a specific timestamp window, ordered from the most recent to the oldest.
2. Retrieve a specific event log's details across all carriers using the unique `EventID`.
3. Update the status of up to 10 event logs simultaneously in a single transaction, ensuring all updates succeed or all fail together.

Which combination of DynamoDB configurations and API operations will meet these requirements most efficiently? (Select TWO.)

  1. Create a Global Secondary Index (GSI) with `CarrierID` as the partition key and `Timestamp` as the sort key. Query this GSI with `ScanIndexForward` set to `false` to retrieve the sorted logs.Cevap
  2. Create a Global Secondary Index (GSI) with `EventID` as the partition key. Query this GSI to retrieve the specific event details, and use the `TransactWriteItems` API to execute the transaction updates.Cevap
  3. C
    Retrieve the specific event details by calling the `Scan` operation on the base table with a `FilterExpression` matching the `EventID`, and use the `BatchWriteItem` API to process the transaction updates.
  4. D
    Create a Local Secondary Index (LSI) with `EventID` as the partition key to query the specific event details, and use the `BatchWriteItem` API to process the transaction updates.
  5. E
    Retrieve the sorted logs by calling the `Scan` operation on the base table with a `FilterExpression` on `Timestamp`, and use the `TransactWriteItems` API to execute the transaction updates.

Cevap

To meet the requirements efficiently, create a Global Secondary Index (GSI) with CarrierID as the partition key and Timestamp as the sort key, and query it with ScanIndexForward set to false. Additionally, create a GSI with EventID as the partition key to query specific events, and use the TransactWriteItems API to perform atomic updates.
To retrieve sorted logs by carrier and timestamp efficiently, a Global Secondary Index (GSI) with CarrierID as the partition key and Timestamp as the sort key is required. Querying this GSI with ScanIndexForward set to false returns the results in descending order. To retrieve an event by EventID without knowing the CarrierID, a GSI with EventID as the partition key is needed. To perform atomic updates on up to 10 logs simultaneously, the TransactWriteItems API must be used because it provides transactional guarantees where either all updates succeed or all fail.

Adım Adım Çözüm

1
Identify the most efficient way to query sorted event logs by carrier and timestamp.
Define a Global Secondary Index (GSI) with CarrierID as the partition key and Timestamp as the sort key. Perform a Query operation rather than a Scan. Set ScanIndexForward to false to return items in descending chronological order.
A Query on a GSI is much more efficient than a Scan on the base table because it target-reads only the matching partition key and sort key range, conserving Read Capacity Units (RCUs).
2
Identify how to retrieve a specific event log across all carriers without knowing the CarrierID.
Define a Global Secondary Index (GSI) with EventID as the partition key. Retrieve the item by performing a Query on this GSI.
Since CarrierID is the partition key of the base table, locating an item by EventID alone would require scanning the entire base table. A GSI on EventID enables direct, single-lookup queries across all partitions.
3
Determine the API operation required for executing atomic write updates across multiple items.
Use the TransactWriteItems API rather than BatchWriteItem.
TransactWriteItems provides ACID transaction guarantees, ensuring that either all status updates succeed or none are applied. BatchWriteItem does not support transactional atomicity and can result in partial successes.

Anahtar Kavram

Optimizing DynamoDB queries and transactions using Global Secondary Indexes (GSIs) and TransactWriteItems.
Bu soruyu puanla