Home > Software design >  Can we set Strong Consistent Read on DynamoDB after creation
Can we set Strong Consistent Read on DynamoDB after creation

Time:04-13

I recently came to know about the two read modes on DDB, and I wanted to implement Strong Consistent Read while that I came across the article https://dynobase.dev/dynamodb-read-consistency/ which mention that the consistency can only be set at time of creation, so can we still use strong consistent read if we have selected eventual consistent read at time of creation of table.

CodePudding user response:

The document that you found is misleading. DynamoDB definitely does not require you to define when creating a table whether or not reads will be "eventually consistent" or "strongly consistent". Rather, on every read operation (GetItem, Query, Scan, BatchGetItem), you need to specify whether this read will be strongly consistent or eventually consistent. The DynamoDB documentation explains the difference between those two read modes. It further says that:

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.

It is possible that DynamoBase (whose documentation you quoted) wraps this per-read-request setting with an additional per-table default read consistency - but it's important to realize that this is not a DynamoDB concept, and there's nothing that forces you to use the same read consistency option every time after creating the table.

  • Related