Dynamodb easy
A table is keyed by `OrderUUID`. However, a customer support dashboard needs to lookup orders by `CustomerEmail`. What feature enables this search without a full table scan?
- A Create a Global Secondary Index (GSI) with `CustomerEmail` as the new Partition Key.
- B Rename the main Partition Key to `CustomerEmail` once a month.
- C Perform a recursive loop in the front-end to find the email address manually.
- D Add a new column and mark it as 'Searchable' in the table properties.
Answer: A. Create a Global Secondary Index (GSI) with `CustomerEmail` as the new Partition Key.
A GSI is essentially a 'Shadow Table' maintained by AWS. It allows you to project your data into a different primary key structure. This makes search-by-email an O(1) query instead of an O(N) scan, preserving performance as the order volume grows.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?