Recall & Review
beginner
What is a composite primary key in DynamoDB?
A composite primary key in DynamoDB is made of two parts: a partition key and a sort key. Together, they uniquely identify each item in a table.
Click to reveal answer
beginner
Why use a composite primary key instead of a simple primary key?
Using a composite primary key lets you store multiple related items with the same partition key but different sort keys. This helps organize data and query it efficiently.
Click to reveal answer
beginner
In DynamoDB, what does the partition key do in a composite primary key?
The partition key decides which partition (storage unit) the data goes to. It groups items together for fast access.
Click to reveal answer
beginner
What role does the sort key play in a composite primary key?
The sort key orders items within the same partition key. It lets you store and query multiple items with the same partition key but different sort keys.
Click to reveal answer
intermediate
How does a composite primary key help with querying data in DynamoDB?
It allows you to find all items with the same partition key and filter or sort them by the sort key. This makes queries more flexible and efficient.
Click to reveal answer
What two parts make up a composite primary key in DynamoDB?
✗ Incorrect
A composite primary key consists of a partition key and a sort key. (Note: Hash key and range key are older terms for partition and sort keys.)
What does the partition key determine in DynamoDB?
✗ Incorrect
The partition key decides which partition stores the item, helping distribute data.
Can two items in DynamoDB have the same partition key but different sort keys?
✗ Incorrect
Items can share the same partition key if their sort keys differ, allowing multiple related items.
What advantage does a composite primary key provide when querying data?
✗ Incorrect
The sort key lets you sort and filter items within the same partition key.
Which of these is NOT true about composite primary keys in DynamoDB?
✗ Incorrect
Items cannot have the same partition key and sort key combination; that would not be unique.
Explain what a composite primary key is in DynamoDB and why it is useful.
Think about how two keys work together to organize and find data.
You got /4 concepts.
Describe how the partition key and sort key work together in a composite primary key.
Consider their roles in storing and retrieving data.
You got /4 concepts.