Dynamo DB Cheat Sheet: Partitions - 10% Rule
Dynamo DB Cheat Sheet: Partitions - 10% Rule
When Dynamo is storing your data it groups it all by the partition key. Multiple partitions can be
stored on a single SSD, but one partition can never be split across multiple SSDs. This means
that you want to make sure that you always create small partition keys. You don’t want to have
one partition, and therefore one SSD, getting hit with most of the requests and becoming
throttled.
= rangeKey = 1598942275
If you have a table containing store information for stores that you sell your products to.
Partition Key Store Brand
Using this you are able to get groups of data but still get a specific item of information.
One Table - Multiple stored datatypes
In another way to use compound keys are to use them to store multiple types of data in a single
table.
An example would be if you are storing data about a customer, traditionally you would have a
table for each type of data you are storing. A table for addresses, a table for orders, etc. With
Dynamo, you can have this all in one table if you create your Sort key correctly.
Get all orders for user 12345 PartitionKey = 12345 AND begins_with(SortKey, 3 orders
order)
Get all orders for 12345 in PartitionKey = 12345 AND SortKey BETWEEN 1 order
August 1596236400 AND 1598914800