Commentary

Comparing RDS and DynamoDB: Understanding Their Mechanisms, Usage, and Selection Methods from an AWS Perspective

Eye-catching image
table of contents

Both RDS and DynamoDB are databases available on Amazon Web Services (AWS), but they are suited to significantly different applications. RDS is suitable for systems that require complex searches, aggregations, and relationship data management, while DynamoDB is suitable for workloads that need to handle high volumes of access with low latency.

The reason it's easy to get confused is that both are often discussed together as "AWS databases." However, what you really need to look at is the nature of the data you'll be handling and the access requirements. Do you want to be able to search flexibly later, or can you pre-determine the access patterns? Choosing without clearly defining these differences will lead to problems in design and operation.

This article will clarify the differences between RDS and DynamoDB, explain the cases in which each is suitable, and discuss the key criteria to consider when choosing between them.

What are the differences between RDS and DynamoDB?

Although RDS and DynamoDB are both AWS databases, they have different underlying assumptions. First, let's get an overview using a comparison table, and then we'll look at the characteristics of each.

Comparison item

RDS

DynamoDB

Data Model

relational database

Key-value document type NoSQL database

Main operations

SQL makes searching, aggregating, and joining easy.

High-speed access based on primary keys and indexes

Specialty uses

Complex business data, systems where consistency is crucial.

Processing requiring high traffic and low latency.

Schema

It is easy to manage by structuring it based on table definitions.

Based on a primary key design, it is easy to assign flexible attributes to each item.

Scalability

Expand as a relational database

Decentralized and easily accommodates large-scale access.

Consistency and Transactions

Easy to use as a relational database

Supports strongly consistent reads (tables/LSIs), and ACID transactions are also available.

Operational approach

Reduce operational load while using a DB engine.

Serverless and fully managed, making it easy to reduce operational burden.

Suitable decision-making criteria

The search requirements are complex, and I also want to be able to aggregate and analyze the results later.

We have a clear access pattern and prioritize speed and scalability.

RDS is a service that provides managed access to relational databases.

Amazon RDS is a managed service that makes it easier to run relational databases on AWS. It allows applications to use relational databases while AWS handles the burden of backups, patching, and hardware management.

RDS is well-suited for situations where you want to organize and handle related data. In business operations that involve handling multiple data points related to each other, such as users, orders, inventory, and invoices, it's easy to structure the data in a tabular format, and it's also easy to search, aggregate, and join using SQL. This is why it's compatible with business systems and core data.

If you anticipate needing to add more search criteria, perform aggregations, or reconcile data later on, RDS is a strong contender. This isn't simply because it supports SQL; it's because it's easier to design based on the relationships between data and can easily accommodate the interpretation methods often required in business operations.

DynamoDB is a key-value document type NoSQL database.

Amazon DynamoDB is a fully managed, serverless NoSQL database offered by AWS. It's a service that prioritizes high scalability and low latency, designed to maintain performance even with workloads involving large amounts of read and write operations. It's not a direct replacement for relational databases like RDS; its underlying philosophy is fundamentally different.

DynamoDB supports key-value and document-type data models. Data is stored in units of tables, items, and attributes, and retrieved based on the primary key. The primary key can be defined as a partition key alone, or a combination of a partition key and a sort key, and the basic principle is to design it by estimating what kind of read and write operations will occur beforehand. This is a different starting point from the idea of ​​RDS, where you can flexibly add search conditions or join tables together later.

DynamoDB is suitable for cases where you need to handle a large volume of access or where access patterns can be defined relatively clearly. Conversely, it is not suitable for business data where search conditions tend to increase later, or for cases where you want to handle related data flexibly. DynamoDB is not a database that makes it easy to search anything; it is a database designed to return necessary read and write data quickly.

Key points to consider when comparing RDS and DynamoDB

This article will summarize the differences between RDS and DynamoDB, including data structure, searchability, consistency, scaling methods, and operational considerations.

The approach to data structures is different.

RDS is a relational database that handles data organized in a tabular format. Because it allows you to define columns and data types and manage data while maintaining relationships between them, it is suitable for business data with a somewhat defined structure. DynamoDB, on the other hand, is a key-value, document-type NoSQL database. Data is stored in units of tables, items, and attributes, and is accessed using the primary key.

This difference isn't just about the storage format. RDS is suited to designs that organize and store related data, while DynamoDB's fundamental design is to first decide what kind of read and write operations you want to perform, and then store the data according to those accesses. Trying to divide the data into small parts and then link them together, as you would with an RDB, doesn't suit the DynamoDB design.

The ease of searching and aggregation is different.

If you need complex searches and aggregations, RDS is easier to use. Because RDS is based on SQL, it's easier to structure processes such as conditional searches, aggregations, sorting, and joins. This difference is significant when dealing with business data that requires flexible searching across multiple tables.

DynamoDB, on the other hand, is suited for high-speed access using primary keys and indexes. While methods like GetItem, Query, and Scan are used for reading, Query, in particular, is an operation that relies on the partition key value. It's not suitable for use cases where you need to freely add search conditions later or handle data with JOINs in mind. A good way to understand it is to think of it this way: RDS for flexible searching, and DynamoDB for situations where you can pre-determine how data is read.

The concept of scalability is different.

RDS and DynamoDB have different scaling assumptions. RDS starts with the premise of stable operation as a relational database. The main approach is to adjust instances and configurations while monitoring performance, and then expand by combining read replicas and storage autoscaling as needed.

DynamoDB, on the other hand, is a NoSQL database designed to handle large-scale access. Its strength lies in its ability to scale easily while maintaining low latency, but this is only possible if the primary key design and access patterns are properly organized. It's not a case of automatic optimization without any effort. Rather than being a database that scales easily, DynamoDB is a database that is designed with scaling in mind.

Consistency and transaction handling are different.

There are also differences in how consistency is considered. Because RDS is treated as a relational database, its strength lies in its ease of designing with the consistency of business data and transaction processing in mind. This premise is particularly useful in situations where you want to update multiple data sets without inconsistencies, such as orders, inventory, and invoices.

DynamoDB is not incapable of handling consistency and transactions. While reads default to eventual consistency, strong consistency reads are also available, and it supports transactions using TransactWriteItems and TransactGetItems. However, it's dangerous to assume they are the same thing. Ensuring consistency and being able to design with the same approach as RDS are two different things. DynamoDB is not suitable for designs that heavily rely on consistency and joins.

The operational load and tuning points are different.

While both RDS and DynamoDB are managed services, the operational considerations are not the same. RDS reduces the burden of backups and patching, but design and performance management that takes into account the characteristics of the DB engine are still necessary. Just because it's managed doesn't mean that the operational challenges of a relational database disappear.

On the other hand, while DynamoDB has a lower infrastructure management burden, its performance and cost are directly affected by primary key design, index design, read consistency, and the use of transactions. In particular, designs that rely heavily on scans should be avoided. In short, RDS tends to make database operations themselves heavy, while DynamoDB places more emphasis on data model design. Just because the operational burden is light doesn't mean that the design is simple.

The choice depends on the requirements.

When choosing a service, you should look at the data it handles and the access requirements, rather than the overall impression of the service.

Prioritize RDS when dealing with complex business data.

In business systems that handle multiple data sets in a linked manner, RDS tends to be preferred. For example, this is the case when searching or updating across multiple tables, such as user, order, inventory, and billing tables. Such data needs to be handled while maintaining consistency, and aggregation and reconciliation are often required later. RDS has a structure that makes it easy to organize and handle such business data.

While it is possible to store business data in DynamoDB, it is not suitable for flexible joins or for use cases where you plan to add search criteria later. With business data, it's crucial to consider how to connect different data and what perspectives you want to use to view the data later. If this flexibility is a priority, it's more natural to consider RDS first.

If high traffic is a given, consider DynamoDB.

If you need to handle a large volume of access with low latency, DynamoDB is a good option. DynamoDB's characteristics are particularly useful in situations where frequent read/write operations occur and a configuration that maintains responsiveness even during periods of high access is required.

However, DynamoDB is not simply a fast database. Its performance and scalability advantages only become apparent when it is designed with primary keys and access patterns in mind. It's not a case of automatically choosing DynamoDB because of high traffic; you need to consider whether you can define the read and write flow beforehand.

If your search requirements aren't finalized, RDS is a safer option.

If your search requirements aren't finalized, RDS is a safer option. RDS makes it easier to later build conditional searches, aggregations, sorting, and joins, and it's more adaptable to changes in requirements. In the early stages of development or during requirements definition, it's not uncommon for requirements like "what search conditions do I want to use?" and "what kind of aggregations are needed?" to increase later on.

DynamoDB, on the other hand, is based on the idea of ​​first determining the access patterns and then designing the data to match how it will be read. Choosing it when the search requirements are still vague can easily lead to a greater burden of redesigning later. If the way you search is likely to change, choosing RDS will make it less likely to have to go back.

DynamoDB is a great option if you can fix the access pattern.

DynamoDB is a strong contender if you can define fairly clearly what kind of read and write operations will occur. For example, this is the case when you can design the access method based on primary keys and indexes, such as retrieving the most recent history by user ID or updating the status for each product ID. In such uses, processing efficiency tends to take precedence over flexibility, and this fits well with the design of DynamoDB.

Conversely, if you frequently need to add more search criteria or view data from different perspectives later on, DynamoDB is less suitable. DynamoDB is not a database that makes it easy to search anything; it's designed to return necessary read and write data quickly. If you can fix the access method, you can better leverage its strengths.

When in doubt, decide based on "the access requirements you need right now."

When deciding between RDS and DynamoDB, the dangerous thing to do is make the decision based on vague expectations such as "it might scale in the future" or "it might become more complex in the future." While it's necessary to consider future possibilities, basing your decision on requirements that haven't yet been finalized easily leads to over-engineering.

What you should consider is what kind of reading and writing is needed, what kind of searching is required, and how strictly consistency is required. If you need flexible searching and relationship data management, choose RDS; if you want clear access methods and to handle high traffic with low latency, choose DynamoDB. Thinking along these criteria will help you stay focused. Database selection should be decided by working backward from the requirements, not based on impressions.

How to choose between RDS and DynamoDB based on use cases

The differences between RDS and DynamoDB become clearer when you look at their actual use cases. Here, we'll organize which is more suitable for each common use case.

RDS is well-suited for business systems and core data management.

RDS is often a strong candidate for managing business systems and core data. This is because it's necessary to handle multiple data points in an interconnected way, such as users, orders, invoices, and inventory. For this type of data, it's crucial that updates and references can be done while maintaining consistency, and that the system can easily accommodate later increases in search criteria and aggregation requirements.

RDS has a structure that makes it easy to organize and handle this kind of business data. In systems where searching, aggregating, and matching across multiple tables is frequent, RDS is a more natural and easier design choice. For applications where you want to reliably process daily transactions and updates, it's more practical to start by considering RDS as the core of your system.

DynamoDB is well-suited for session management, games, and IoT applications.

DynamoDB is well-suited for applications that require low latency processing of frequent reads and writes or large volumes of access, such as session management, games, and IoT. In these areas, the ability to quickly return fixed read and write operations is often more important than complex joins and aggregations.

For data with relatively clear access patterns, such as state management and event processing, DynamoDB's design tends to be well-suited. For data that needs to be handled quickly based on primary keys and indexes, such as session information, player data, and device status, it is a strong candidate.

The selection of member information and order information varies depending on the requirements.

While data such as member information and order information might seem like it could be handled by either, the actual choice depends on the requirements. For example, if all you need is fast ID-based retrieval of member information, DynamoDB can handle it. On the other hand, if you need filtering by member attributes, searching with multiple conditions, and cross-referencing with purchase history and point information, RDS is easier to design.

The same applies to order information. If you only need to be able to quickly access it on an order ID basis, DynamoDB is a viable option. However, if you need to maintain consistency across sales orders, line items, inventory, shipping, and billing, RDS is a more natural choice. You shouldn't decide based solely on the name of the data, but rather on how you will use that data.

There are also configurations that combine RDS and DynamoDB.

In practice, it's not uncommon to see configurations that don't rigidly choose between RDS and DynamoDB. This is because different data types require different storage locations, even within the same system.

For example, it's perfectly possible to manage core business data in RDS and store session information and event status requiring low latency in DynamoDB. Rather than thinking in terms of a win-or-lose choice, it's more straightforward from a design perspective to organize things by deciding which role each system should handle.

Points that are likely to cause regret in the design process

RDS is prone to performance issues when the load increases, and DynamoDB can easily become problematic in terms of searches and costs if access patterns are misjudged. Choosing based solely on advantages will reveal flaws in the design later on.

RDS often presents challenges in scaling when access increases.

While RDS can easily reduce operational burden, it doesn't automatically resolve performance issues that arise when access increases. When traffic and data volume increase, you need to determine where the bottleneck lies by looking at CPU, memory, storage performance, read replica configuration, etc.

Systems with many complex searches, aggregations, and joins tend to experience this burden. While RDS is an easy-to-use service, it cannot escape the performance management responsibilities inherent in relational databases. If you assume that "it's managed, so AWS will handle everything from now on" during implementation, weaknesses in the design will become apparent when the load increases.

DynamoDB tends to struggle when flexible search requirements arise later on.

DynamoDB is a service that works well with designs that rely on primary keys and indexes for high-speed access. Conversely, if requirements arise later, such as wanting to search using different criteria or wanting to increase aggregation and cross-search capabilities, it becomes easier to revise the design.

A particularly troublesome issue arises when attempting an analytical reading and relying on `Scan`. This often leads to decreased efficiency and cost. DynamoDB is a database where it works better to decide on the necessary reading methods beforehand, rather than trying to make it searchable for anything later.

Designing DynamoDB with the same mindset as RDBs often leads to failure.

A common mistake when using DynamoDB is directly applying the design philosophy of relational databases (RDBs). The idea of ​​dividing tables into many small parts and joining them later as needed does not work well with DynamoDB. DynamoDB is not built around the assumption of JOINs, but rather its basic design is based on determining how data is stored according to the required access.

Failure to implement this transition can easily lead to problems such as inflexible searching, wasted effort with each retrieval, and higher-than-expected costs. DynamoDB should not be chosen haphazardly as a replacement for relational databases; it should be used with the understanding that access patterns are the core of the design process.

Choosing based solely on price can easily lead to making a wrong decision.

Choosing based solely on price is risky. RDS is a service that considers instances, storage, and I/O as prerequisites, while DynamoDB is a service that is more susceptible to read/write capacity and access patterns. It's not simply a matter of which is cheaper; the cost structure changes depending on what kind of read/write operations occur and how frequently.

In practice, prioritizing a design that meets the requirements rather than the lowest initial estimate reduces the likelihood of failure. Choosing DynamoDB when flexible searching and relationship data management are needed will likely lead to increased design changes and peripheral implementation costs later on. Conversely, choosing RDS when the focus is on high-traffic, simple access will increase the burden of performance optimization and scalability design. While cost is ultimately important, making decisions based solely on price lists increases the likelihood of making mistakes.

Summary

Both RDS and DynamoDB are databases available on AWS, but they are suited to significantly different requirements. RDS is ideal for systems requiring complex searches, aggregations, relationship data management, and data consistency. DynamoDB, on the other hand, allows for clear definition of access patterns and is suitable for applications that need to handle high traffic with low latency.

When making your selection, the question shouldn't be which is superior, but rather which best suits your current requirements. If your search requirements are likely to change, RDS is a good choice; if your read/write needs are clear and you prioritize processing efficiency and scalability, DynamoDB is a better option. Thinking along these lines will help you make a decision.

In practice, it's not uncommon to see configurations that don't rigidly choose one over the other. Sometimes, it's more straightforward to separate roles, such as using RDS for core data and DynamoDB for sessions and state management. The requirements, not the service names, should be the first thing to look at.

Kazuki Kato
The person who wrote the article
Kazuki Kato

Server Works Co., Ltd.
Marketing Department, Marketing Section 1
After working in sales for independent ISPs and system integrators, where I was involved in optimizing customers' systems and networks, I joined Serverworks. Since joining, I have worked on development standardization projects for power carriers and proposed and implemented station announcement systems for railway operators. Currently, I am in charge of event marketing and inside sales.
My hobby is washing cars.
AWS Certified Database – Specialty (DBS)

If you have any questions about AWS,
issues like these?

If you have any questions or concerns about using AWS, getting quotes, configuring your system, or operating it, please feel free to contact us.
We help facilitate smooth decision-making by establishing a shared understanding with the local team and clarifying the prerequisites.

We offer end-to-end solutions to address all your AWS-related challenges.

Image of a city nightscape intersecting with blue lines of light symbolizing a digital network