Amazon DynamoDB (50 Qs)•Part 3: Advanced Architecture, Scale & Internals (Senior / Lead)
What is the GSI Write Amplification problem and how do you minimize it?
senior LevelSystem Design
In Simple Words: Every time an item is updated, DynamoDB must write to every GSI whose index attributes are present on the item:
- If a table has 5 GSIs, a single item update may consume 1 base table WCU + 5 GSI WCUs!
- Sparse Indexes: Only populate the GSI partition key attribute when the item needs to be indexed (e.g. only set
isFlagged: truefor flagged items). Null or omitted attributes are not indexed, saving capacity.