In DynamoDB, why is choosing a good partition key important for performance?
Think about how data is spread out to avoid overloading one place.
The partition key decides how data is split across storage nodes. A good key spreads data evenly, so no single partition gets too much traffic, which keeps performance steady.
Given a DynamoDB table where most items share the same partition key value, what is the expected impact on query performance?
Consider what happens when too many requests target the same storage node.
If many requests hit the same partition key, that partition can become overloaded, causing throttling and slower responses.
Which table design best supports fast queries for user orders by user ID and order date?
Table: Orders Attributes: UserID (string), OrderID (string), OrderDate (string), Amount (number) Options: A) Partition key: OrderDate, Sort key: UserID B) Partition key: UserID, Sort key: OrderDate C) Partition key: Amount, Sort key: OrderID D) Partition key: OrderID, Sort key: UserID
Think about how you would find all orders for a user sorted by date.
Using UserID as partition key groups all orders by user. Sorting by OrderDate allows efficient retrieval in date order.
You have a table with a partition key 'Country' and most data is from one country. How can you redesign the table to improve performance?
Think about adding more uniqueness to the partition key to spread data.
Combining Country and UserID creates more unique partition keys, distributing data and workload better to avoid hot partitions.
A DynamoDB table has a partition key 'UserID' but queries for recent activity are slow. The table has many users but most queries target a few active users. What is the main cause?
Consider how query patterns affect partition load.
Even with many users, if most queries hit a few UserIDs, those partitions get overloaded, causing slow performance.