Truncate a DynamoDB Table

Truncate scans the table for item keys and deletes the items in batches. It is a permanent data operation.

What truncate changes

  • It deletes items from the selected table.
  • It keeps the table and its key schema.
  • It keeps indexes and table configuration.
  • It does not create a backup or rollback point.

Before you truncate

  1. Confirm the AWS profile, Region, and table name.
  2. Export or back up data that you must keep.
  3. Stop application writes when you need a predictable empty-table result.
  4. Confirm that no import job is active on the table.
  5. Review read and write capacity before you start.

Starting truncate clears staged item changes in the active table tab.

Start the job

  1. Select Truncate Table in the table action bar.
  2. Read the confirmation message.
  3. Confirm the exact table.
  4. Start the truncate job.
Dynomate confirmation dialog that warns a table truncate permanently deletes all items
Confirm the table identity before you start the permanent delete operation.

Monitor or cancel

The table view shows the job state, scanned item count, deleted item count, estimated progress, and estimated time when available.

Cancel does not restore deleted items

Cancel stops future scan and delete work. Items that were already deleted remain deleted. A cancelled or failed job can leave some items in the table.

Concurrent writes

Truncate does not lock the table and does not read from a fixed snapshot. An application can write items while the job runs. A concurrent item can survive or be deleted, based on when the scan reaches its key.

Stop producers before truncate when the table must be empty at completion. Verify the table after the job finishes, then restart the producers.

Dynomate blocks an import and a truncate job from running at the same time on the same table. It also blocks another active truncate job for that table.

Capacity and cost

Truncate uses a parallel full table scan and batch deletes. The scan consumes read capacity. The deletes consume write capacity. Both operations can incur cost and can throttle application traffic.

  • Run truncate during a low-traffic period.
  • Monitor consumed read and write capacity.
  • Monitor throttled requests.
  • Plan for a longer job on a large or heavily throttled table.

AWS permissions

  • dynamodb:DescribeTable to read the schema and table estimates.
  • dynamodb:Scan to read item keys.
  • dynamodb:BatchWriteItem to delete items.