Writes & Operations
You assume DynamoDB enforces uniqueness like a SQL unique index, deploy without a condition expression, and discover duplicate accounts in production. There is no cross-attribute constraint — only atomic writes you design yourself.
Writes are item-scoped, batched with hard limits, and easy to amplify across hot
partition keys. Migrations are application-level because there is no ALTER TABLE.
This section covers batch APIs, return values, counters, uniqueness patterns,
online reshaping, and the operational scar tissue when one partition key absorbs
too much traffic.
What you can do after
- Use
BatchWriteItemand batch delete within the 25-item / 16 MB limits without silent partial failure. - Implement atomic counters and multi-attribute uniqueness with conditional writes.
- Plan a zero-downtime migration with dual-write or backfill patterns.
- Spot a hot partition from write distribution and key choice before throttling.
Reading order
- Batch operations —
BatchWriteItemcaps, unprocessed keys, and why batch is not a transaction. - Delete multiple items — batch delete vs staged delete in tooling; capacity per removed item.
- ReturnValues —
ALL_OLD,UPDATED_NEW, and what comes back without a second read. - Atomic counters —
ADDupdates and why read-modify-write loses under concurrency. - Unique multiple attributes — uniqueness items and conditional puts that reject duplicates.
- Migrations — reshape keys and GSIs while traffic is live; no schema migration button.
- Hot partition — skewed keys, write spikes, and design fixes.
TransactWriteItems accepts up to 25 actions across up to 10 items, with a 4 MB
transaction payload cap. Cancel reasons include ConditionalCheckFailed,
TransactionConflict, and TransactionInProgress — each maps to a different retry
strategy. BatchWriteItem also caps at 25 items but does not roll back siblings on
failure — you handle UnprocessedItems in application code.
ReturnValues let you implement compare-and-swap without a follow-up GetItem. Atomic
counters use ADD on a numeric attribute; uniqueness across attributes typically needs
a separate "lock" item per unique value plus a conditional put on the main row. A
migration that rewrites sort keys on a hot USER#popular partition can throttle
writes for every user sharing that key's physical partition — schedule backfills with
rate limits and watch the table's Overview for skew before you cut over.
Workbench steps
Download DynoTable with a paid trial to stage writes: edit an item,
review the diff, and commit — the default path for put/update/delete. Batch delete
via ⌘⇧⌫ commits directly; ⌘⌫ stages first. PartiQL INSERT/UPDATE/DELETE executes
immediately with a warning toast, so treat PartiQL DML as a direct write path.
A table's Overview shows item counts and size estimates so you can see growth before a migration. The pricing calculator models write amplification when a migration doubles write traffic during dual-write.
Free read-only plans cover queries and exports; staging and commits require an active license or trial.