I'm trying to figure out how writes work with Global Secondary Indexes (GSI) in DynamoDB. I'm dealing with a hot write problem and want to avoid hitting the 1000 write units per second limit for my base table. My setup uses a partition key of `user_id` and a sort key of `target_user_id`. This helps with scalability, but I anticipate a lot of simultaneous writes to the same `target_user_id`. To manage this, I've created a GSI with reversed keys. My main question is: if writes hit the GSI limit, does that cause the base table write to be rejected? Or do writes go through and the GSI just takes longer to catch up? If it's the second scenario, I can deal with eventual consistency, but the first scenario could restrict my app's scalability, and I may need to rethink my strategy.
4 Answers
For more resources, check these links out:
- AWS Databases Overview
- DynamoDB Documentation
- Aurora and Redshift
Also, consider searching for more forum discussions related to GSIs to gather additional insights.
Absolutely! Check out the AWS documentation on GSI throttling. It highlights how a hot partition in your GSI can throttle the base table's writes, which is why planning your GSI partition keys is critical.
DynamoDB will reject updates if the GSI falls behind the base table by more than 5 seconds. So it’s essential to keep an eye on GSI performance to prevent throttling.
You're on the right track. The hot partition issue affects GSI too. My old team used DynamoDB streams to create a writing buffer for our query table, which worked well as a fallback solution.
Totally agree! When working with GSIs, remember that you're essentially building a secondary table. Ensuring a high degree of cardinality in your partition key is crucial to avoid these issues.

Is there any official documentation on that? I'd love to read more.