Item Best Practices

Understand the art behind creating items.

Size limit

We can’t have an item bigger than 400 KB in a DynamoDB table. However, we can have as many items as we want in a table.

Attribute names

Attribute names like Book_id are stored within attributes and are therefore counted towards an item’s size. Therefore, we should use short, intuitive attribute names to keep item sizes low. For example, “BkId” would be a good attribute name for Book_id because it is short but informative.

Compressed attributes

Sometimes, there are larger attributes, such as in the case of a Facebook post. To save the text of the post, we will need a lot of storage space, probably a few tens of KB. To use a minimal amount of this space, we can save the text of the post in a compressed format. We can use GZIP for compressing our attribute values.

Dividing Items

we can also divide bigger items into smaller items wherever there is a one-to-many relationship.

Get hands-on with 1200+ tech skills courses.