Imagine you have a DynamoDB table storing user orders. Which reason best explains why selecting a good partition key matters?
Think about how DynamoDB stores data internally and what happens if too many items share the same partition key.
A good partition key spreads data evenly across partitions, avoiding hot spots that slow down reads and writes. Options B, C, and D are incorrect because data is distributed, indexes require design, and sort keys are optional but unrelated to partition key choice.
Given a DynamoDB table with partition key 'Country' and sort key 'UserID', what happens if most users are from the same country?
Table: Users Partition Key: Country Sort Key: UserID Data: 90% users have Country = 'USA', 10% others Question: How does this affect performance?
Consider how DynamoDB partitions data based on the partition key only.
Since partition key is 'Country', all 'USA' users share the same partition, causing a hot partition. Sort key does not affect partition distribution. DynamoDB does not automatically split hot partitions instantly. Queries on hot partitions slow down.
Choose the correct AWS CLI command snippet to create a DynamoDB table with a partition key named 'UserID' of type string.
aws dynamodb create-table --table-name Users --attribute-definitions ... --key-schema ... --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Check the valid attribute types for partition keys in DynamoDB.
Partition keys must be of type String (S), Number (N), or Binary (B). BOOL and SS (string set) are invalid for keys. Option B uses String type correctly.
You have a DynamoDB table storing sensor readings. Each sensor sends data every second. Which partition key design best avoids hot partitions?
Think about how to spread writes evenly when sensors send frequent data.
Using only 'SensorID' may cause hot partitions if some sensors send more data. Using timestamp alone groups all data by time causing hot spots. A constant partition key causes a single hot partition. Concatenating 'SensorID' with date creates more partitions and balances load.
Given a table with partition key 'UserID' and sort key 'OrderDate', a query filters orders for UserID='123'. Despite low total traffic, the query is throttled. What is the likely cause?
Query:
{
TableName: 'Orders',
KeyConditionExpression: 'UserID = :uid',
ExpressionAttributeValues: { ':uid': '123' }
}Consider what happens if one partition key value has a lot of data.
Throttling happens because the partition for UserID='123' is overloaded with many orders. Query syntax is valid. High provisioned throughput does not cause throttling. Sort key is optional in queries filtering by partition key.