Beginner10 min read

When to Use DynamoDB (and When Not To)

The deciding question is "do I know my access patterns up front, and are they key-based?" Get that right and DynamoDB gives you single-digit-millisecond reads at any scale. Get it wrong and each new question needs a new index or a scan.

When should I use DynamoDB?

  • Use DynamoDB when your access patterns are known, key-based and high-volume, and you want predictable latency at any scale with no servers to manage.
  • Avoid it when you need ad-hoc queries, rich joins or analytics over the whole dataset as your main workload, or when the data is small and the query shapes keep changing.
  • The core trade: DynamoDB makes you design for your queries up front; in return latency stays flat as you grow, as long as your keys spread the load.
  • It is not a relational database with a different syntax. Modeling it like one is the most common source of pain.

Already have a table? DynoTable connects to your data directly, so you can test the signals below against your real items.

The signals that favor DynamoDB

DynamoDB shines when most of these hold:

  • You know your access patterns in advance. You can list the exact queries the app makes ("get a user by id", "list a user's support tickets newest-first") and they don't change on a whim. DynamoDB is modeled around those queries.
  • Access is key-based. You look items up by a known partition key, not by scanning for arbitrary attribute combinations.
  • Scale and predictable latency matter. DynamoDB delivers consistent single-digit-millisecond performance whether the table holds a thousand items or a billion.
  • You want zero operational overhead. No instances, no failover, no vacuuming. It's fully managed, and in on-demand mode it costs nothing for throughput while idle.
  • Write throughput is high and spiky. Event logs, IoT telemetry, audit trails, leaderboards: append-heavy workloads with a clear key.

The signals against it

Reach for a relational database (or a search/analytics engine) instead when:

  • Your queries are ad-hoc. Analysts slice the data by arbitrary columns, or requirements change weekly. SQL's flexibility wins; DynamoDB would need a new index per pattern.
  • You need joins and aggregations across the whole dataset. Reporting, business intelligence, "sum revenue by region by month" is an OLAP job. On DynamoDB data, export it for that work (see Analytics on DynamoDB data).
  • The dataset is small and low-traffic. A few thousand rows on a quiet admin app gets no benefit from DynamoDB's scale and loses SQL's convenience.
  • You can't predict access patterns yet. Early-stage product still finding its shape? A relational schema you can re-query freely is more forgiving until the patterns settle.

The one-off question against a live table is a different case: DynoTable's SQL Workbench runs JOIN (INNER or LEFT, onto a table's key or a GSI partition key), GROUP BY and aggregates over DynamoDB client-side. It's the standing BI workload that belongs elsewhere.

No, ad-hoc / changingYesYesNoYesNo, small + quietNew workloadAccess patterns known +key-based?Relational DBNeed cross-dataset joins /analytics?High scale or spiky writes?DynamoDB

How DynamoDB compares to other databases

"Should I use DynamoDB or X?" usually comes down to one question: does X let me postpone the access-pattern decision, and what do I pay for that? DynamoDB is the option that refuses to let you postpone it.

Relational: PostgreSQL, RDS, and Aurora

A relational database lets you write the query after you have the data. DynamoDB shapes the table around the queries before a single item is written, and this is the choice teams most often get wrong.

Pick relational when the query shapes are still moving, when you need joins or aggregates across the whole dataset, or when the data is small enough that scale isn't your problem.

Pick DynamoDB when the patterns are settled and key-based and you want them to cost the same at a billion items as at a thousand.

RDS and Aurora are managed relational engines, so they keep SQL's flexibility and its scaling model. Aurora Serverless weakens DynamoDB's "no servers to manage" argument, and the decision falls back onto access patterns.

Document: MongoDB and DocumentDB

Both store JSON-like documents, so they can look interchangeable with DynamoDB. The difference is the query model: MongoDB indexes any field and runs ad-hoc queries; DynamoDB serves the keys and indexes you declared in advance.

That makes MongoDB the better fit for evolving query shapes, and DynamoDB the better fit for known ones at high volume. DocumentDB speaks the MongoDB API on AWS, so compare it on the same flexibility-versus-predictability axis.

Wide-column: Cassandra

Cassandra is DynamoDB's closest architectural relative: partition key, clustering key, and the same rule that a bad partition key can't be fixed by adding indexes.

The deciding factors between them are rarely the data model. They are who runs it and how you pay: you operate Cassandra or buy it managed (Amazon Keyspaces on AWS), while DynamoDB has no cluster to run.

Because the models are so close, the modeling guidance on this site mostly transfers: the single-table design reasoning about partition keys and access patterns applies to Cassandra almost line for line.

In-memory: Redis

Redis is memory-first and optimized for sub-millisecond access. Its persistence is optional, so it suits data you can rebuild, unless you run a durable variant such as Amazon MemoryDB. DynamoDB is durable by default.

The common production answer is both: DynamoDB as the system of record, Redis (or DAX, DynamoDB's own read-through cache) in front of the hot keys. Use Redis alone only for ephemeral data such as rate-limit counters or short-lived locks.

Search: Elasticsearch and OpenSearch

DynamoDB has no keyword (full-text) search. Query matches on key equality and a narrow set of sort-key conditions. There are no analyzers, no fuzzy matching, no faceting, no keyword relevance.

Scan with a FilterExpression is a table walk, not a search: it reads every item, discards most of them, and bills you for the items read rather than the items returned.

It does have vector indexes: SearchVectors returns the items whose embeddings are most similar to a query vector, ranked by score. That covers semantic search ("tickets like this one"); see vector search.

For keyword relevance, analyzers and facets you still need a search engine. The standard shape is DynamoDB as the system of record and an OpenSearch index fed from it.

The managed feed is the DynamoDB zero-ETL integration with Amazon OpenSearch Service, an OpenSearch Ingestion pipeline. It loads a snapshot through export to S3, then follows DynamoDB Streams without using the table's throughput.

It needs point-in-time recovery on and Streams set to new and old images. Write your own Lambda on the stream only when you need transforms the pipeline's processors can't express.

Either way you run a second system, and the index is eventually consistent with the table.

OpenSearch and Elasticsearch are the same decision here. OpenSearch is the fork AWS started from Elasticsearch 7.10 in 2021, after Elastic's license change. Choose between them on licensing, hosting and which managed service you want.

Reach for a search engine as the primary store only when search is the product: log analytics, or a catalog searched by free text. Even then, keep a durable store behind it: a search index is a derived view you must be able to rebuild.

Analytics on DynamoDB data

When DynamoDB is your system of record and you need reporting, don't scan the live table. Export it instead:

  1. Turn on point-in-time recovery for the table; export requires it.
  2. Export to S3, from the console or with aws dynamodb export-table-to-point-in-time --table-arn <arn> --s3-bucket <bucket>. Exports read the backup, not the table, so they use no read capacity. Full or incremental, as DynamoDB JSON or Ion.
  3. Query the export with Athena: define a table over the exported files (a Glue crawler can infer it) and run SQL there.

For a warehouse that stays current without a pipeline of your own, the zero-ETL integration with Amazon Redshift replicates the table every 15 to 30 minutes using incremental exports, also with point-in-time recovery on.

Exporting DynamoDB walks through the S3 export step by step.

Counting the cost before you commit

The bill depends on the capacity mode. On-demand DynamoDB bills per request (read and write request units) plus storage, so an idle table costs only its storage. That makes it cheap for spiky and serverless workloads.

Provisioned DynamoDB bills by the hour for the read and write capacity you set, used or not, much like an instance. Reserved capacity lowers that rate for a one- or three-year commitment (three-year terms aren't offered in every Region), on Standard table class tables only.

In either mode, sustained heavy scanning is where DynamoDB gets expensive, because a scan pays for every item it reads.

Indexes are the multiplier to watch. On a relational engine an extra index costs storage and some write latency; on DynamoDB each global secondary index is written alongside the table.

With an ALL projection and items up to 1 KB, one GSI roughly doubles the write bill and two triple it. An update that changes an index key costs two index writes; a narrow projection or a sparse index costs less.

The indexes overview works the arithmetic at three write volumes. Model your real read/write mix in the pricing calculator before you commit; a workload that fits technically should also pencil out on cost.

Once you've decided it fits

The work shifts to modeling. DynamoDB rewards designing the table around your queries: see how to model data in DynamoDB and single-table design, and when not to reach for single-table.

Browsing a populated DynamoDB table in DynoTable's item grid.
Browsing a populated DynamoDB table in DynoTable's item grid.

Pitfalls + next steps

  • Don't model DynamoDB like a relational database. Joining normalized tables at read time is the pattern it punishes hardest.
  • Don't run analytics on the live table. Export to S3 and query with Athena, or replicate to Redshift with zero-ETL, as described above.
  • Unsure about access patterns? Wait. Adopting DynamoDB before you know your queries is choosing the one database that demands you know them.
  • Related: query vs scan shows what "key-based access" buys you.

Want to explore a DynamoDB table before betting your app on it? Download DynoTable and connect to your data directly. Its SQL Workbench runs JOINs and aggregates over your keys and indexes: SQL within DynamoDB's access-pattern rules.

By Dmitriy · Updated