Why can't I get consistent reads for global secondary indexes?
I have the following setup:
Table: tblUsers (id as hash)
Global secondary index: tblUsersEmailIndex (email as a hash, identifier as an attribute)
Global secondary index: tblUsersUsernameIndex (username as a hash, id as an attribute)
I request indexes to check if a given email or username is present, so I am not duplicating the user.
Now the problem is that I cannot perform consistent reads for index queries. But why not? This is one of the few times when I really need updated data.
According to AWS documentation:
Global secondary index queries only support consistency.
Changes to the table data apply to global secondary indexes within a fraction of a second under normal conditions. However, in some unlikely failure scenarios, large propagation delays can occur. Because of this, your applications must anticipate and handle situations where a query on the global secondary index returns results that do not match the latter .
But how do I deal with this situation? How can I make sure that this email or username is not already present in db?
source share