Search⌘ K
AI Features

Database: DynamoDB

Explore the fundamentals of DynamoDB in this lesson, including its unique role as a durable cloud data structure, cost considerations with on-demand and provisioned pricing, and how its local and global indexes affect performance and scalability. Understand when DynamoDB fits your project and the tradeoffs involved in query processing and storage compared to relational databases.

Data structure in the cloud

Amazon describes DynamoDB as a database, but it’s best seen as a highly-durable data structure in the cloud. A partitioned B-tree data structure, to be precise.

svg viewer

DynamoDB is much more similar to a Redis than it is to a MySQL. But, unlike Redis, it is immediately consistent and highly-durable, centered around that single data structure. If you put something into DynamoDB, you’ll be able to read it back immediately and, for all practical purposes, you can assume that what you have put will never get lost.

It is true that DynamoDB can replace a relational database, but only if you think you can get away with storing all your data in a primitive B-tree. If so, then DynamoDB makes a great default choice for a database.

DynamoDB vs relational database

The following table shows some high-level differences between DynamoDB and relational database:

widget

Query processing

Having to do most query processing on the application side isn’t just inconvenient. It also comes with performance implications. Relational databases run their queries close to the data, so if you’re trying to calculate the sum total value of orders per customer, then that rollup gets done while reading the data, and only the final summary (one row per customer) gets sent over the network. However, if you were to do this with DynamoDB, you’d have to get all the customer orders (one row per order), which involves a lot more data over the network, and then you have to do the rollup in your ...