DVA-C02 Question 90
Single answerYou are building a serverless e-commerce application that uses Amazon DynamoDB as the database. When a customer places an order, the application updates the 'Orders' table. The application must immediately display the updated order details to the customer to ensure they see the latest information. Which DynamoDB consistency model should you use when querying the 'Orders' table to meet this requirement?
- A
Strongly consistent reads
- B
Eventually consistent reads
- C
Transactional reads
- D
Parallel reads across multiple partitions
Show answer and explanation
Correct answer: A
Explanation
To ensure the application displays the latest order details to the customer immediately after an update, you must use strongly consistent reads. This consistency model guarantees that the data returned by the read operation reflects all writes that were completed before the read. Eventually consistent reads, while more performant, do not guarantee immediate consistency and could return outdated information.
- A. Correct.
Strongly consistent reads ensure that the data returned reflects all writes that were received before the read request, which is necessary to display the latest order details immediately to the customer.
- B. Incorrect.
Eventually consistent reads may return stale data because they do not guarantee that the most recent writes are reflected in the response. This is not suitable for the requirement to display updated order details immediately.
- C. Incorrect.
Transactional reads are used for operations that require atomicity across multiple items, but they are not specifically designed to ensure immediate consistency for individual reads.
- D. Incorrect.
Parallel reads across multiple partitions are a strategy for improving query performance but do not affect the consistency model of the read operations.