⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials ⚖️ Editorial Policy Standards & Trust 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 69 of 69 in Databases & Storage
Senior DevOps / SRE Database AWS Aurora & DynamoDB Production Runbook
🎯 Target Role / Context: Senior DevOps / SRE DynamoDB Indexing & Capacity Interview Scenario

Q: How does an under-provisioned GSI throttle base table writes in Amazon DynamoDB, and how do you fix it?

DynamoDB interview questions on GSI backpressure: diagnose throttled writes with CloudWatch GSI metrics, raise GSI capacity, and design sparse indexes.

#DynamoDB #Global Secondary Index #Write Throttling #CloudWatch #AWS #SRE
🎙️ Candidate Opening & Architectural Context
"A frequent trap in dynamodb interview questions is a table that throttles writes while its own write capacity looks healthy. A global secondary index has its own write capacity, separate from the base table. Writes to the base table are propagated to each GSI asynchronously, but if a GSI cannot absorb its share of those updates, the backlog pushes back and writes to the base table get throttled. So an under-provisioned GSI, or a GSI keyed on a skewed attribute, can throttle writes to a table that has plenty of capacity itself. I diagnose it from the GSI's own metrics, then fix capacity and key design."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: A frequent trap in dynamodb interview questions is a table that throttles writes while its own write capacity looks healthy. A global secondary index has its own write capacity, separate from the base table. Writes to the base table are propagated to each GSI asynchronously, but if a GSI cannot absorb its share of those updates, the backlog pushes back and writes to the base table get throttled. So an under-provisioned GSI, or a GSI keyed on a skewed attribute, can throttle writes to a table that has plenty of capacity itself. I diagnose it from the GSI's own metrics, then fix capacity and key design.

1

Spot the Pattern: Base Table Throttled, Base Capacity Fine

The first clue is a mismatch: write requests fail with throttling, but ConsumedWriteCapacityUnits on the table is below the provisioned value. I describe the table and list every GSI with its provisioned throughput. A GSI with a much smaller WriteCapacityUnits than the table, especially on a table with high write volume, becomes the suspect.

aws dynamodb describe-table --table-name Events \
  --query 'Table.{Table:ProvisionedThroughput.WriteCapacityUnits,
                  GSIs:GlobalSecondaryIndexes[].{Name:IndexName,
                       WCU:ProvisionedThroughput.WriteCapacityUnits}}'
# Table: 1000
# GSIs: [{"Name": "status-created-index", "WCU": 50}]
2

Read the GSI-Level CloudWatch Metrics

WriteThrottleEvents is published with a GlobalSecondaryIndexName dimension, so I query it per index alongside TableName. A rising sum on the index while the base table metric looks calm confirms the cause. OnlineIndexThrottleEvents is a separate metric that applies while a new index is being backfilled, so I check it if the problem began right after creating an index.

aws cloudwatch get-metric-statistics --namespace AWS/DynamoDB \
  --metric-name WriteThrottleEvents \
  --dimensions Name=TableName,Value=Events Name=GlobalSecondaryIndexName,Value=status-created-index \
  --start-time 2026-11-29T09:00:00Z --end-time 2026-11-29T10:00:00Z \
  --period 300 --statistics Sum

aws cloudwatch get-metric-statistics --namespace AWS/DynamoDB \
  --metric-name OnlineIndexThrottleEvents \
  --dimensions Name=TableName,Value=Events Name=GlobalSecondaryIndexName,Value=status-created-index \
  --start-time 2026-11-29T09:00:00Z --end-time 2026-11-29T10:00:00Z \
  --period 300 --statistics Sum
Advertisement
3

Raise GSI Write Capacity or Move to On-Demand

The quick fix is to give the index enough write capacity to match the table's write rate, because each base write that touches indexed attributes consumes capacity on the index too. With provisioned mode, I update the specific GSI. If traffic is unpredictable, on-demand billing removes the need to size each index, at a different cost profile. I apply the change and watch the GSI throttle metric return to zero.

aws dynamodb update-table --table-name Events \
  --global-secondary-index-updates '[{"Update":{
    "IndexName":"status-created-index",
    "ProvisionedThroughput":{"ReadCapacityUnits":50,"WriteCapacityUnits":1000}}}]'

# Or switch the whole table (and its indexes) to on-demand
aws dynamodb update-table --table-name Events --billing-mode PAY_PER_REQUEST
4

Choose a Well-Distributed GSI Partition Key

More capacity does not help if the index key is skewed. A GSI keyed on a low-cardinality attribute such as status concentrates every write on a few index partitions, and the per-partition limits apply to indexes as well. I prefer a high-cardinality partition key, or a composite key that adds a bounded shard value, for example status#3. Queries then fan out across the shard values and merge the results.

# Item attribute written by the application: gsi_pk = "PENDING#" + (hash(order_id) % 8)
aws dynamodb update-table --table-name Events \
  --attribute-definitions AttributeName=gsi_pk,AttributeType=S AttributeName=created_at,AttributeType=S \
  --global-secondary-index-updates '[{"Create":{
    "IndexName":"gsi-sharded-status",
    "KeySchema":[{"AttributeName":"gsi_pk","KeyType":"HASH"},{"AttributeName":"created_at","KeyType":"RANGE"}],
    "Projection":{"ProjectionType":"KEYS_ONLY"},
    "ProvisionedThroughput":{"ReadCapacityUnits":20,"WriteCapacityUnits":500}}}]'
5

Reduce Index Write Load with Sparse Indexes and Smaller Projections

A GSI only contains items that have its key attributes, so I can keep it sparse. If the index exists to find unprocessed items, set the key attribute only while the item is unprocessed and remove it afterward. Items that never had or no longer have the attribute cost the index nothing. Projecting only KEYS_ONLY or selected attributes also shrinks the work done per write.

# Write the indexed attribute only while the item is pending
aws dynamodb put-item --table-name Events --item '{
  "pk":{"S":"evt#1001"},"sk":{"S":"v1"},
  "pending_pk":{"S":"PENDING#3"},"created_at":{"S":"2026-11-29T10:00:00Z"}}'

# Remove it when processed so the item leaves the index
aws dynamodb update-item --table-name Events \
  --key '{"pk":{"S":"evt#1001"},"sk":{"S":"v1"}}' \
  --update-expression "REMOVE pending_pk"
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"For dynamodb interview questions on GSIs, state that each GSI has its own write capacity and that a throttled index can throttle base table writes, diagnose it with WriteThrottleEvents by GlobalSecondaryIndexName, fix it by raising GSI WCU or using on-demand, and prevent repeats with a well-distributed index key, sparse indexes and minimal projections."
⚡ 60-Second Elevator Pitch Talking Points
  • When writes throttle with spare table capacity, I look at each GSI's provisioned write capacity first.
  • I confirm with WriteThrottleEvents using the GlobalSecondaryIndexName dimension, and OnlineIndexThrottleEvents after new index creation.
  • I fix it with update-table, raising that index's WCU or moving to on-demand.
  • I then redesign the index key for even distribution and use sparse indexes with small projections to cut write load.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Raising only the base table's write capacity The throttled resource is the index, so the base table change leaves the bottleneck in place.
  2. Using a low-cardinality attribute like status as a GSI partition key All index writes land on a handful of partitions, which hit per-partition limits regardless of total capacity.
  3. Projecting ALL attributes into every GSI by default Larger projections increase the write cost of each base table update.
  4. Ignoring OnlineIndexThrottleEvents during index creation A backfill running into throttling can take far longer, so the new index may appear stuck.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →