Search code examples
amazon-dynamodbdynamodb-queriesamazon-dynamodb-indexdynamodb-gsi

Make DynamoDB GSI strongly consistent


How long should I wait after putting the record to make scan/query using GSI strongly consistent? My use case has asynchronous workflows which can afford to wait for 5-10 minutes. I need to know how much wait time is sufficient to ensure that I'm getting strongly consistent reads.

I know we can use DynamoDB transactions to simulate strongly consistent GSIs. But I don't want to write this as my use case can be solved by introducing wait.


Solution

  • GSIs are inherently eventually consistent. The time period between a write to the base table and the data then appearing in the GSI tends to be single-digit milliseconds. Sometimes you'll see a few seconds delay, such as if the leader node on the GSI partition died and a new leader had to be chosen before the write could propagate. It would be extremely unlikely for the delay to be 5 minutes.