DynamoDB rewards designing from the questions backwards. A worked example for orders and customers: the access-pattern table, the keys and items, one overloaded secondary index, a sparse index for open orders, and how item size sets the bill (a 4.1 KB item costs twice as much to read as a 4.0 KB one).
PK = C#1042 (a customer)
One Query returns the profile and recent orders together.
PK = O#88121 (an order)
Line items live with their order, not their customer.
GSI1 (order ID)
GSI2 (sparse)
Remove the attribute when the order ships and it leaves the index.
Items in one table, grouped by partition key
Eventually consistent
Strongly consistent
Transactional
Cost per million reads by item size, US East on-demand. Reads are charged per 4 KB, rounded up; $0.125 per million read request units.
Standard write
With one secondary index projecting the item
Cost per million writes by item size. Writes are charged per 1 KB, rounded up; $0.625 per million write request units. An index that projects the item is written too.
Short attribute names: they are stored, and billed, on every item.
Large or rarely read data (documents, images, long text) in S3, with the key in the item.
Project only what an index needs (KEYS_ONLY or INCLUDE), since every projected byte is written twice.
Prefer eventually consistent reads unless the screen must show a write the same user just made.
Never Scan in a request path. If a question needs a Scan, it needs an index, a Stream-fed aggregate, or a different database.
Bring your access patterns. We'll sketch the keys and indexes with you and tell you if Postgres would be simpler. Free, 30 minutes.
Once a month: what changed in tech that month and what it means for you, from cloud and AI to security and the tools you build with. Every item links to its source. No sales pitch, unsubscribe in one click.
Book a free 30-minute call about it. Bring your setup and your bill; you'll leave knowing what we'd do first and roughly what it costs, whether or not you hire us.
Or keep reading
DynamoDB vs Postgres, Measured in AWS: 53 Workloads From the Same Client
We ran 53 workloads against RDS Postgres 17 and DynamoDB from one Fargate task in the same Availability Zone, at 100,000, 1 million and 5 million orders. Key lookups took 0.35 ms in Postgres and 2.7 ms in DynamoDB; a two-item transaction 1.75 ms against 20 ms; a question nobody designed for, 0.08–2.7 s against a full table scan. The full results, with the method and every caveat.
Read
Ad-Hoc Questions on DynamoDB vs Postgres: 16 Analytics Queries at 100,000, 1 Million and 5 Million Orders
Every question across customers is a full table scan in DynamoDB: 217,000 read units at 5 million orders, whether it returns 10 rows or all of them. Postgres answered the same 16 questions in 0.08 to 2.7 seconds without a single index added for them, and an index built in 2.7 seconds took one from 148 ms to 44 ms. Measured in AWS.
Read
As of November 4, 2026. Provided as is, for general information, and accurate to the best of our knowledge on the date shown. Not legal, compliance, tax, financial or other professional advice. Prices, limits and vendor services change; check current vendor documentation before relying on anything here. Terms of use.