DEV Community

Cover image for DynamoDB Design Patterns for Single Table Design
Marko - ServerlessLife.com
Marko - ServerlessLife.com

Posted on

DynamoDB Design Patterns for Single Table Design

DynamoDB is the beast that combined with the right design patterns unlocks the potential of unlimited scalability, performance, and low price. However, designing DynamoDB data models can be tricky. Its feature set is limited, but with the correct design patterns, mainly based on prevailed single table design, you can cover almost all use cases that are expected from an OLTP system.

There are multiple resources about designing DynamoDB that did not exist a few years ago. However, I still could not find a short and concise list of design patterns, hence the need for this article. The intention here is not to explain in detail how DynamoDB works, but please see the resources section for more information if needed.

RDBMS databases (SQL databases) were designed at a time when data storage was expensive but processing power was relatively cheap. You save costs with data normalization (removing duplicated data, etc.). But when reading the data, you need to denormalize. This normalization and denormalization require computing power. The only way to scale up the RDBMS database, except with sharding and replication, is vertical, putting it in a larger machine.

Nowadays, we store incomparably more data. Storage is cheap. Correlating to data-size processing power is expensive. With a lot of data, vertical scaling is no longer an option. You have to split data and load it onto multiple computers. That is why we needed a paradigm shift from RDBMS databases. That came with the key-value store and document databases as a variant of NoSQL databases. DynamoDB is one of the most established solutions in that space.

DynamoDB is a hyper scalable, performant, and afordable managed NoSQL database. It should be the first choice for serverless and all solutions that demand scalability. However, because of scalability requirements, like all NoSQL databases, it lacks features common in RDBMS databases. Designing data models is quite difficult and goes against established principles of designing RDBMS databases. That is why it is even more difficult for beginners.

DynamoDB also has fewer features than some other NoSQL databases. That is for a reason. It provides only features that are scalable, in contrast to other databases like MongoDB, which is feature richer.

Continue reading…

Top comments (0)