DynamoDB Single-Table Design: A Complete Guide
Unlike relational databases, DynamoDB encourages developers to think about how data is accessed rather than how entities are related. Instead of creating separate tables for users, orders, products, and payments, a single-table design stores multiple entity types together in one table using carefully designed keys. The objective is not simply to reduce the number of tables, but to organize related data so that common application queries can be answered efficiently with as few requests as possible.
Single-table design represents one of the biggest mindset shifts for engineers coming from SQL databases. Rather than modeling normalized relationships first and optimizing later, DynamoDB encourages designing the schema around application access patterns from the beginning.
Multiple Entity Types in One Table
A single DynamoDB table can contain many different entity types simultaneously. For example, a table may store users, orders, order items, customer addresses, payments, and shipping events together while distinguishing them using partition keys, sort keys, and entity prefixes.
Although these entities coexist within the same table, they remain logically organized through predictable key structures that allow related items to be retrieved efficiently.
Organizing Data Around Access Patterns
Instead of asking how data should be normalized, DynamoDB asks how the application retrieves information. Every important screen, API endpoint, or business workflow becomes an access pattern that influences how partition keys and sort keys are designed.
This approach minimizes expensive database operations because related information is intentionally stored together according to expected query behavior.
Single-Table Design Is a Modeling Strategy
Single-table design is not a DynamoDB feature that must be enabled. It is an architectural approach for organizing data inside DynamoDB tables using key design, secondary indexes, and predictable access patterns.
Whether an application stores two entity types or twenty, the underlying principle remains the same: organize data so the database can retrieve exactly what the application needs with efficient key-based queries.
| Concept | Responsibility |
|---|---|
| Single Table | Store multiple entity types |
| Partition Key | Group related items |
| Sort Key | Organize items within a partition |
| Access Patterns | Drive schema design |
Why Single-Table Design Matters in DynamoDB
Engineers familiar with relational databases often begin by identifying entities and creating separate tables connected through foreign keys. While this approach works well for SQL databases, DynamoDB is optimized differently. Since it does not support joins in the traditional sense, applications must retrieve related information through carefully designed keys rather than combining multiple tables during query execution.
Single-table design exists because DynamoDB prioritizes predictable, low-latency queries at massive scale. Designing around access patterns allows applications to retrieve related data efficiently while minimizing database requests.
DynamoDB Does Not Use Joins

Relational databases combine data using joins whenever information spans multiple tables. DynamoDB intentionally avoids this model because joins become increasingly expensive as systems scale horizontally across many storage partitions.
Instead of reconstructing relationships during query execution, DynamoDB encourages storing related data together so it can be retrieved through efficient key-based lookups.
Reducing Query Round Trips
Many application screens require several related pieces of information simultaneously. A user profile page, for example, might display customer information, recent orders, saved addresses, and account settings.
Single-table design allows these related records to be stored under the same partition key, enabling the application to retrieve everything with a single query rather than performing numerous database requests.
Designing for Scale
DynamoDB achieves extremely high scalability by distributing data across partitions according to partition keys. Predictable access patterns allow the database to locate data efficiently without scanning large portions of the table.
By designing keys around known workloads, engineers create applications that remain responsive even as datasets grow into billions of records.
| Relational Modeling | DynamoDB Single-Table Design |
|---|---|
| Normalize entities | Model around access patterns |
| Retrieve data using joins | Retrieve data using keys |
| Multiple table lookups | Single efficient queries |
| Schema-first design | Query-first design |
Core Concepts Behind Single-Table Design
Although single-table design initially appears unusual, it relies on only a few fundamental building blocks. Partition keys determine where data is stored, sort keys organize related items, item collections group connected records together, and generic key names allow multiple entity types to coexist within the same table. Understanding these concepts makes even complex single-table schemas much easier to reason about.
Most successful DynamoDB applications build sophisticated data models using these relatively simple primitives.
Partition Key
The partition key determines how DynamoDB distributes data across storage partitions. Every item sharing the same partition key belongs to the same logical group and can be retrieved efficiently through a single query.
Choosing an appropriate partition key is therefore one of the most important design decisions because it affects scalability, performance, and workload distribution simultaneously.
Sort Key
Within each partition, the sort key organizes related items into a predictable order. Applications can retrieve individual items, ranges of items, or subsets matching specific prefixes without scanning unrelated data.
Sort keys often encode hierarchy, timestamps, entity types, or workflow stages to support efficient application queries.
Item Collections
All items sharing the same partition key form an item collection. Instead of storing only a single entity, an item collection may include a customer profile, orders, payment history, addresses, and account preferences that naturally belong together.
This grouping allows applications to retrieve complete business objects using a single partition key lookup.
Generic Key Names
Many DynamoDB tables use generic attribute names such as PK, SK, GSI1PK, and GSI1SK rather than entity-specific column names. These generic attributes provide flexibility because the same table can represent many different entity types while reusing the same indexing strategy.
Although the attribute names remain generic, the encoded values clearly identify the underlying entity relationships.
| Core Concept | Purpose |
|---|---|
| Partition Key | Group related items |
| Sort Key | Organize items within a partition |
| Item Collection | Store related entities together |
| Generic Keys | Support multiple entity types |
Access Pattern First Data Modeling
Perhaps the biggest difference between DynamoDB and relational databases is that schemas are designed around application queries rather than entity relationships. Before defining partition keys or sort keys, engineers first identify every important operation the application must perform. Only after understanding these access patterns does the schema begin to take shape.
This query-first mindset often feels unfamiliar initially, but it produces highly efficient systems because every important request has a direct path to the required data.
Identify Application Workflows
The design process begins by listing the application’s primary read and write operations. These might include retrieving a customer’s profile, listing recent orders, displaying invoices, updating inventory, or viewing transaction history.
Understanding these workflows establishes the foundation for every subsequent key design decision.
Design Around Queries
Each important application query should correspond to a predictable partition key, sort key condition, or secondary index. Engineers intentionally organize data so frequently executed operations require as few database requests as possible.
If retrieving data requires multiple unrelated queries, the schema usually requires additional refinement.
Avoid Relational Thinking
Engineers transitioning from SQL frequently begin by creating separate entities before considering application behavior. In DynamoDB this often leads to fragmented data, unnecessary queries, and inefficient scans.
Instead, DynamoDB encourages thinking about how users interact with the application rather than how entities relate conceptually.
Validate Every Access Pattern
Before implementing the schema, every planned query should be verified against the proposed key structure. Engineers should confirm that each access pattern can be satisfied through efficient key-based operations rather than scans or multiple sequential requests.
This validation process significantly reduces future redesign effort as applications scale.
| Planning Step | Objective |
|---|---|
| Identify Workflows | Understand application behavior |
| Design Queries | Map queries to key structures |
| Avoid SQL Thinking | Focus on access patterns |
| Validate Queries | Ensure efficient retrieval |
Primary Key Design in Single-Table Models
Primary keys form the foundation of every DynamoDB single-table design because they determine how data is distributed, grouped, and retrieved. Well-designed keys allow applications to satisfy common access patterns efficiently while avoiding scalability problems such as uneven partition utilization. Poor key design, on the other hand, often leads to expensive scans, hot partitions, and difficult schema migrations.
Successful DynamoDB applications invest significant effort in designing primary keys before writing application code.
Partition Key Patterns
Partition keys commonly represent logical business entities such as users, organizations, tenants, or accounts. Values like USER#123, ORDER#456, or TENANT#acme clearly identify the item collection while distributing data predictably across partitions.
Choosing meaningful partition keys helps group related information while maintaining balanced workload distribution.
Sort Key Patterns
Sort keys frequently represent hierarchy, timestamps, entity types, or workflow stages. Values such as PROFILE, ORDER#2026-07-02#001, or PAYMENT#987 allow related items to coexist within the same partition while remaining easy to query individually.
Encoding additional structure inside the sort key greatly increases query flexibility without requiring additional indexes.
Composite Keys
Composite keys combine multiple pieces of business information into predictable string formats. Entity type prefixes, dates, status values, and identifiers often appear together so a single sort key can support many related query patterns.
These structured keys make it possible to retrieve precisely the subset of items needed for different application workflows.
Avoiding Hot Partitions
Poor partition key selection can concentrate excessive traffic onto a small number of storage partitions. Popular tenants, shared resources, or sequential identifiers sometimes create hotspots that reduce throughput despite DynamoDB’s distributed architecture.
Designing partition keys with balanced traffic distribution in mind helps maintain consistent performance as workloads grow.
| Key Strategy | Example |
|---|---|
| Partition Key | USER#123 |
| Sort Key | ORDER#2026-07-02#001 |
| Composite Key | Entity + hierarchy + timestamp |
| Balanced Keys | Distribute workload evenly |
Modeling Relationships in a Single Table
Although DynamoDB does not support joins, it still allows applications to represent complex relationships efficiently. Instead of reconstructing relationships dynamically during query execution, related entities are organized so they naturally appear together within item collections or can be retrieved through secondary indexes. This shift from relational joins to key-based modeling is one of the defining characteristics of single-table design.
Understanding these relationship patterns enables DynamoDB to represent sophisticated business domains while maintaining predictable query performance.
One-to-One Relationships
One-to-one relationships are typically modeled by storing closely related items under the same partition key with different sort keys. A user profile, account settings, authentication preferences, and billing information can all belong to the same user partition while remaining separate items.
Applications retrieve these related records efficiently through a single partition query.
One-to-Many Relationships
Many business domains naturally contain one-to-many relationships such as customers with orders, organizations with projects, or accounts with transactions. These relationships are modeled by placing all related child items under the parent’s partition key while distinguishing them using structured sort keys.
This approach allows applications to retrieve either individual records or complete collections efficiently.
Many-to-Many Relationships
Many-to-many relationships require additional modeling techniques because each entity may relate to many others. A common approach is the adjacency-list pattern, where relationship items connect both sides of the association while secondary indexes provide efficient reverse lookups.
This pattern supports relationships such as students and courses, users and groups, or products and categories without requiring relational joins.
Hierarchical Relationships
Hierarchical structures such as organizations, folders, comments, or product catalogs can be modeled using sort key prefixes that encode parent-child relationships. Applications retrieve complete hierarchies by querying shared partition keys together with appropriate sort key conditions.
Carefully structured sort keys allow hierarchical traversal while maintaining the efficient key-based access that DynamoDB is designed to provide.
| Relationship Type | Modeling Strategy |
|---|---|
| One-to-One | Multiple items under one partition |
| One-to-Many | Parent partition with child sort keys |
| Many-to-Many | Adjacency-list pattern with GSIs |
| Hierarchical | Sort key prefixes and hierarchy encoding |
Global Secondary Indexes and Access Patterns
A well-designed primary key allows DynamoDB to answer the application’s most common queries efficiently, but real-world systems often need to retrieve the same data in multiple ways. An e-commerce platform may need to retrieve orders by customer, while customer support may need to retrieve those same orders by status or order ID. Global Secondary Indexes (GSIs) solve this problem by providing alternate access paths without duplicating entire tables.
GSIs are one of the most powerful features in DynamoDB, but they should be designed carefully because every additional index increases storage usage, write costs, and operational complexity.
What GSIs Do
A Global Secondary Index defines an alternative partition key and optional sort key for the same underlying data. Instead of querying only through the table’s primary key, applications can retrieve items using different business attributes that better match specific access patterns.
This flexibility allows one dataset to support multiple application workflows while maintaining efficient key-based queries.
GSI Overloading
Rather than creating a separate index for every entity type, many single-table designs intentionally overload a single GSI to support several unrelated query patterns. Generic attributes such as GSI1PK and GSI1SK store different values depending on the entity being indexed.
Although the index structure remains generic, consistent key prefixes allow the application to distinguish different entity types while minimizing the total number of indexes required.
Sparse Indexes
Not every item in a DynamoDB table must appear in every GSI. Only items containing the indexed attributes become part of the secondary index, creating what is commonly called a sparse index.
Sparse indexes reduce storage consumption and write costs because only items participating in a particular access pattern are indexed.
GSI Tradeoffs
Every write affecting indexed attributes must also update the corresponding GSIs. This increases write latency, consumes additional write capacity, and introduces eventual consistency for index queries.
Architects should therefore create GSIs only when they support clearly identified access patterns that cannot be satisfied efficiently through the primary key.
| GSI Feature | Purpose |
|---|---|
| Alternate Keys | Support additional query paths |
| GSI Overloading | Reuse indexes for multiple entities |
| Sparse Index | Index only selected items |
| Additional Cost | Increased writes and storage |
Query Patterns in Single-Table Design
Single-table design succeeds only when it supports the application’s most important queries efficiently. Rather than providing unlimited flexibility for arbitrary searches, DynamoDB encourages engineers to identify predictable query patterns and optimize the schema around them. Every important screen, API endpoint, or workflow should correspond to a known partition key, sort key condition, or secondary index.
Designing around these predictable access patterns allows DynamoDB to deliver consistent low-latency performance even at massive scale.
Fetching a Complete Item Collection
One of the biggest advantages of single-table design is retrieving multiple related entities through a single query. A customer profile, recent orders, payment history, addresses, and account settings may all share the same partition key, allowing the application to load an entire business object efficiently.
This minimizes network round trips while simplifying application logic.
Prefix Queries
Sort key prefixes enable applications to retrieve only specific subsets of related data. Instead of loading every item within a partition, queries can use conditions such as begins_with to return only orders, payments, notifications, or transactions.
This flexibility allows one partition to support many different application views without additional indexes.
Time-Based Queries
Many applications organize activity chronologically. By encoding timestamps within sort keys, DynamoDB naturally supports queries such as retrieving recent orders, recent transactions, activity feeds, or audit logs.
Ordering data within the sort key allows recent information to be retrieved efficiently without scanning unrelated records.
Reverse Lookups
Sometimes applications need to retrieve data using attributes that are not part of the primary key. Global Secondary Indexes enable these reverse lookups by providing alternate partition keys for queries such as retrieving all pending orders, all users within an organization, or all invoices awaiting payment.
Combining well-designed primary keys with carefully selected GSIs allows one table to satisfy a wide variety of application requirements.
| Query Pattern | Typical Solution |
|---|---|
| Related Business Object | Shared partition key |
| Entity Subset | Sort key prefix query |
| Time-Based Retrieval | Timestamp in sort key |
| Alternate Lookup | Global Secondary Index |
Benefits and Tradeoffs of Single-Table Design
Single-table design can deliver exceptional performance and scalability when it aligns closely with an application’s access patterns. By organizing related data together and minimizing the number of database requests required for common workflows, applications often achieve lower latency and more predictable performance than equivalent relational implementations. At the same time, these advantages come with increased modeling complexity that requires careful planning before development begins.
Understanding both the strengths and limitations of the approach helps architects decide when it is appropriate for a particular workload.
Benefits
One of the biggest advantages of single-table design is efficient data retrieval. Related entities are intentionally stored together, allowing applications to answer complex business queries with one or two database operations instead of multiple joins or sequential lookups.
This predictable access model also simplifies capacity planning because every important query is known before deployment rather than being discovered through production traffic.
Tradeoffs
The primary cost of single-table design is increased modeling effort. Engineers must understand application access patterns thoroughly before defining partition keys, sort keys, and secondary indexes. Changing those decisions later often requires significant migration work.
Ad-hoc queries also become more difficult because the schema is optimized for predefined workloads rather than exploratory database access.
Operational Impact
Operating a single-table design requires continuous monitoring of partition utilization, GSI capacity, item sizes, and access pattern evolution. As applications grow, new features may introduce additional query requirements that require schema extensions or new indexes.
Teams adopting single-table design should invest in documentation because understanding encoded keys becomes increasingly important as more entity types are introduced.
| Benefit or Tradeoff | Impact |
|---|---|
| Lower Latency | Fewer database requests |
| Predictable Performance | Query-first modeling |
| Higher Modeling Complexity | More up-front design effort |
| Operational Monitoring | Track partitions and GSIs |
Common Mistakes in DynamoDB Single-Table Design
Many difficulties associated with DynamoDB arise not from the database itself but from applying relational design principles to a system optimized for access-pattern-driven modeling. Common mistakes often produce unnecessary scans, inefficient indexes, uneven partition utilization, and higher operating costs. Avoiding these problems early significantly improves long-term scalability.
Most production issues stem from schema design decisions rather than limitations within DynamoDB itself.
Starting with Entity Tables
Engineers coming from SQL often begin by creating separate tables for users, products, orders, and payments before considering how those entities will actually be queried. This frequently results in applications performing multiple sequential queries to reconstruct business objects.
Single-table design instead begins with application workflows and organizes entities accordingly.
Ignoring Access Patterns
Designing keys before understanding application queries almost always produces inefficient schemas. Every important read and write operation should be identified before partition keys and secondary indexes are finalized.
Unknown access patterns typically become expensive scans or require additional indexes later.
Overusing GSIs
Global Secondary Indexes provide tremendous flexibility, but adding too many increases storage consumption, write amplification, and operational complexity. Creating an index for every possible query often produces diminishing returns.
Indexes should support important production workloads rather than hypothetical future requirements.
Creating Hot Partitions
Choosing partition keys with uneven traffic distribution can overload individual storage partitions even when overall table capacity remains available. Popular tenants, sequential identifiers, or shared resources often become bottlenecks if not modeled carefully.
Balanced partition key design remains one of the most important scalability considerations in DynamoDB.
Splitting Entities Incorrectly
Excessively fragmenting related information across unrelated partitions forces applications to issue multiple database requests that single-table design is intended to avoid.
Related business objects should remain grouped whenever application workflows retrieve them together.
| Common Mistake | Better Practice |
|---|---|
| Start with entities | Start with access patterns |
| Ignore query design | Validate every important query |
| Too many GSIs | Create only necessary indexes |
| Hot partitions | Design balanced partition keys |
| Fragment related data | Group related entities together |
DynamoDB Single-Table Design in System Design Interviews
Single-table design frequently appears in AWS-focused System Design interviews because it demonstrates an understanding of DynamoDB’s unique data modeling philosophy. Interviewers are generally less interested in whether candidates can memorize key prefixes than whether they understand why DynamoDB favors access-pattern-driven design over relational normalization. Explaining these tradeoffs clearly demonstrates practical cloud architecture knowledge.
Strong candidates justify their schema using business workflows instead of describing the table structure in isolation.
When to Introduce Single-Table Design
Single-table design becomes appropriate when applications have predictable access patterns, require consistently low latency, operate at very large scale, or rely heavily on DynamoDB as their primary database. Serverless APIs, e-commerce systems, SaaS platforms, gaming backends, and IoT workloads commonly fit these characteristics.
Candidates should explain why the workload benefits from predictable key-based queries before recommending the pattern.
What Interviewers Evaluate
Interviewers typically evaluate access pattern analysis, partition key selection, sort key structure, relationship modeling, secondary index design, and strategies for avoiding hot partitions. They also expect candidates to discuss tradeoffs rather than presenting single-table design as the universal solution.
Demonstrating awareness of operational complexity usually strengthens architectural discussions.
Common Candidate Mistakes
A common mistake is recommending DynamoDB without explaining how queries will actually be performed. Others describe entity relationships without identifying partition keys, ignore GSIs, or fail to consider uneven workload distribution.
Successful candidates explain how every important application workflow maps directly to an efficient DynamoDB query.
| Interview Topic | What Interviewers Evaluate |
|---|---|
| Access Patterns | Query-first thinking |
| Key Design | Partition and sort key quality |
| GSIs | Appropriate alternate access paths |
| Scalability | Hot partition avoidance |
| Tradeoff Analysis | Balanced architectural reasoning |
Frequently Asked Questions About DynamoDB Single-Table Design
Single-table design is one of the most powerful DynamoDB modeling techniques, but it is also one of the most misunderstood because it requires engineers to abandon many familiar relational database assumptions. Questions about partition keys, GSIs, relationships, and table organization are common when teams first adopt DynamoDB.
Understanding these concepts helps clarify when single-table modeling provides real architectural value.
What is DynamoDB single-table design?
Single-table design is a modeling strategy that stores multiple related entity types within one DynamoDB table. Data is organized around application access patterns using partition keys, sort keys, and secondary indexes.
The objective is efficient query execution rather than minimizing the number of tables.
Why use one table instead of multiple tables?
A single table allows related entities to be retrieved together through efficient key-based queries. This reduces the number of database requests and avoids the need for relational joins that DynamoDB does not support.
The approach improves performance when application access patterns are well understood.
Does single-table design mean all data must be in one item?
No. Single-table design stores many items within one table, not one item containing all application data. Related items remain separate while sharing partition keys that allow them to be retrieved together efficiently.
Maintaining separate items keeps the model flexible while preserving efficient access.
Does DynamoDB single-table design require GSIs?
No. Many applications function entirely through the primary key. GSIs become necessary only when additional access patterns cannot be satisfied efficiently using the table’s primary key.
Indexes should support clearly defined business requirements rather than being created by default.
Is single-table design always better?
No. Applications with unpredictable query requirements or frequently changing access patterns may benefit more from simpler data models. Single-table design works best when workloads are well understood before implementation.
Its additional modeling complexity should always be justified by performance requirements.
How do you model many-to-many relationships?
Many-to-many relationships are commonly represented using adjacency-list patterns together with Global Secondary Indexes for reverse lookups. This allows each side of the relationship to retrieve related entities efficiently without joins.
The exact implementation depends on the application’s access patterns.
How do you avoid hot partitions?
Balanced partition key selection is the primary strategy. Keys should distribute traffic evenly across storage partitions while avoiding values that concentrate excessive read or write activity on a small subset of partitions.
Monitoring production workloads also helps identify emerging hotspots before they become bottlenecks.
When should you avoid single-table design?
Applications with exploratory reporting, unpredictable analytical queries, or rapidly changing access requirements may not benefit from highly optimized single-table schemas. In these situations, simpler designs may provide greater flexibility even if individual queries become less efficient.
Choosing the appropriate modeling strategy always depends on workload characteristics.
| Question | Short Answer |
|---|---|
| What is single-table design? | Multiple entity types in one table |
| Why use one table? | Optimize known access patterns |
| One item for all data? | No |
| Are GSIs always required? | No |
| Always the best choice? | No |
| How to avoid hot partitions? | Design balanced partition keys |
Final Thoughts
DynamoDB single-table design represents a fundamentally different way of thinking about database modeling. Instead of organizing data around normalized entities and reconstructing relationships during query execution, it organizes data around predictable application access patterns so related information can be retrieved efficiently with minimal database requests. When implemented well, this approach delivers consistent low-latency performance, excellent scalability, and efficient use of DynamoDB’s distributed architecture.
At the same time, single-table design requires careful planning because partition keys, sort keys, and secondary indexes influence both application performance and long-term maintainability. Engineers who understand access patterns, relationship modeling, item collections, and hot partition avoidance can build highly scalable DynamoDB applications that remain efficient even as workloads grow dramatically. Rather than treating single-table design as a best practice for every application, successful architects adopt it when its query-first philosophy aligns naturally with the system they are building.
- Updated 12 hours ago
- Fahim
- 21 min read