Dynamodb easy
DynamoDB supports two types of Primary Keys. What is the fundamental difference between a 'Simple' and a 'Composite' primary key?
- A A simple key uses a timestamp, while a composite key uses a random UUID.
- B A composite key consists of a 'Partition Key' and a 'Sort Key', enabling one-to-many relationships and range queries within a partition.
- C A simple key is for reads, and a composite key is required for writes.
- D A composite key is only used when the data size exceeds 100GB.
Answer: B. A composite key consists of a 'Partition Key' and a 'Sort Key', enabling one-to-many relationships and range queries within a partition.
A Composite Primary Key (PK + SK) allows you to group related items together. For example, in a `Comments` table, the `PK` could be `ThreadID` and the `SK` could be `Timestamp`, allowing you to efficiently query all comments for a specific thread sorted by time.
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?