A user updates a profile and immediately reloads, but the GSI query still returns the old value.
IntermediateTroubleshootingRDS, Aurora and DynamoDB
Answer
Likely causes → Global secondary indexes are updated asynchronously and only support eventually consistent reads. ConsistentRead=true is rejected on a GSI.
Diagnose →
aws dynamodb query --table-name users --index-name email-index \
--key-condition-expression 'email=:e' --expression-attribute-values '{":e":{"S":"[email protected]"}}'
aws dynamodb get-item --table-name users --key '{"userId":{"S":"u-1"}}' --consistent-read
Fix →
- For read-after-write views, read from the base table by primary key with
--consistent-read - Or use an LSI (it supports strong consistency but must be created with the table)
- Or return the updated item to the client from the write response
Prevent → Decide consistency needs per access pattern during design, and watch OnlineIndexPercentageProgress and GSI throttles.
More on RDS, Aurora and DynamoDB
The app cannot connect to RDS: `psql: error: connection to server at "mydb.abc.us-east-1.rds.amazonaws.com" (10.0.3.12), port 5432 failed: Connection timed out`.Beginner`FATAL: password authentication failed for user "postgres"` and nobody knows the master password.Beginner`FATAL: no pg_hba.conf entry for host "10.0.1.25", user "app", database "orders", no encryption`.IntermediateApp logs show `FATAL: remaining connection slots are reserved for non-replication superuser connections` (or MySQL `ERROR 1040 (HY000): Too many connections`).IntermediateRDS status shows `storage-full` and writes fail.IntermediateA read replica's `ReplicaLag` keeps growing and reports show stale data.Intermediate