What is the recommended way to delete a large number of items from DynamoDB?

前端 未结 7 2157
情歌与酒
情歌与酒 2020-11-29 21:51

I\'m writing a simple logging service in DynamoDB.

I have a logs table that is keyed by a user_id hash and a timestamp (Unix epoch int) range.

When a user of

7条回答
  •  無奈伤痛
    2020-11-29 22:36

    If you want to delete items after some time, e.g. after a month, just use Time To Live option. It will not count write units.

    In your case, I would add ttl when logs expire and leave those after a user is deleted. TTL would make sure logs are removed eventually.

    When Time To Live is enabled on a table, a background job checks the TTL attribute of items to see if they are expired.

    DynamoDB typically deletes expired items within 48 hours of expiration. The exact duration within which an item truly gets deleted after expiration is specific to the nature of the workload and the size of the table. Items that have expired and not been deleted will still show up in reads, queries, and scans. These items can still be updated and successful updates to change or remove the expiration attribute will be honored.

    https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

提交回复
热议问题