1

Use case:

Each user has a list of items. When creating a new item in the UI, it is added to DynamoDB and then the whole list is fetched again, in order to display fresh results.

The issue is that in some case the newly added item does not appear in that list, being an eventually consistent read based on an index (index based on that userId).

What is the correct way to handle this situation ?

the "item" table has "itemId" as primary partition key and "userId" as primary partition key for an index (which is queried when reading the list).

Horatiu Jeflea
  • 7,256
  • 6
  • 38
  • 67

1 Answers1

0

DynamoDB uses eventually consistent reads, unless you specify otherwise. Read operations (such as GetItem, Query, and Scan) provide a ConsistentRead parameter. If you set this parameter to true, DynamoDB uses strongly consistent reads during the operation.

rohitwtbs
  • 509
  • 5
  • 17